Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Manipulate open file or highlighted lines in WinBatch Studio ScreenFileUtility v1.7
;***************************************************************************************** ; Program Title: ScreenFileUtility v1.7 * ; * ; Author: Steffen Fraas, sfraas@zoo.co.uk * ; * ; FileMath functions: written by Marty Williams * ; * ; Date: 30/10/2001 * ; * ; Synopsis: Manipulate open file or highlighted lines in WinBatch Studio, * ; or files by filename. * ; * ; Functions: Data information * ; Character Count * ; Sort (Ascending) (FileMath) * ; Sort (Descending) (FileMath) * ; Remove Duplicate lines (FileMath) * ; Get Duplicate lines (FileMath) * ; ADD (FileMath) * ; SUBTRACT (FileMath) * ; OR (FileMath) * ; XOR (FileMath) * ; AND (FileMath) * ; Sort on column range (FileMath) * ; Shift columns * ; Delete columns * ; Save columns * ; Insert columns from file * ; Insert columns * ; Replace columns * ; All upper case * ; All lower case * ; Add line number * ; Append screen data/file to a file * ; Append screen data to a new file * ; Find data between columns * ; Drop blank lines * ; Wrap lines * ; Centre/Align lines * ; Append data to lines * ; Prepend data to lines * ; Remove leading character/s * ; Remove trailing character/s * ; Hex for Hex replacement * ; Hex for String replacement * ; String for Hex replacement * ; Multiple Hex deletions * ; Display Hex * ; Compare 2 files * ; Compare screen data to a file * ; Compare 2 screen sections * ; Compare directories * ; Export comments for spell checking * ; Import spell-checked comments * ; Insert lines from a file * ; Split file * ; Join files * ; * ; * ; CALLed routines/modules: Screenfileutility.wbt * ; * ; Input/Output files: * ; * ; Documentation File: * ; * ; Installation: Save this file in WinBatch.exe's directory * ; * ; Requirements: * ; * ; Minimum Winbatch: v2001a * ; For Compares: Microsoft's WinDiff program. * ; In function Compareresults, point Run command at WinDiff.exe. * ; Windiff requires gutils.dll, and optionally windiff.hlp * ; For spellchecking: Default invocation of spell checker is WinEdit. To invoke a * ; different spell checker, NoteTab Pro for example, change * ; function SPELLCHECKDATA accordingly. * ; * ; Clipboard limitation: * ; Depending on the Operating System used, the 'holding' * ; capacity of the Clipboard may affect screen-data-manipulation * ; functions. * ; * ; For screen data manipulation add next two lines into wspopup.mnu * ; * ; ScreenFileUtilities \ {F7} ; must start in column 1 * ; Call(StrCat(Dirhome(),"Screenfileutility.wbt"),"") ; must start in column 5 * ; * ; To start ScreenFileUtilities in WinBatch Studio, press F7 or click the right * ; mouse button and click on ScreenFileUtilities. * * ; * ; To process a range of lines in WinBatch Studio, first highlight line/s before * ; invoking utility. Default is all lines. * ; * ; * ; For file data manipulation add a shortcut to desktop pointing at this file and assign * ; a hotkey. * ; * ; * ; For Explorer context support add the following two lines, starting in column 1 and * ; column 5 respectively, before `File Operations` in file * ; "FileMenu for all filetypes.mnw", which resides in WinBatch.exe's directory: * * ; * ; ScreenFileUtility ; Column 1 * ; Run(StrCat(homedir,"winbatch.exe"),StrCat("""",homedir,"ScreenFileUtility.wbt",""" ",CurrFilePath())) ; Column 5 ; * ;***************************************************************************************** ; * ; History: * ; * ; v1.2 * ; * ; added: * ; Compare 2 files * ; Compare screen data to a file * ; Compare 2 screen sections * ; Add line numbers * ; * ; v1.3 * ; * ; added: * ; Compare directories * ; * ; v1.4 * ; * ; added: * ; Append screen data/file to a file * ; Append screen data to a new file * ; * ; added: * ; Explorer context support * ; * ; v1.5 * ; * ; added: * ; Stop multiple batch ScreenFileUtility invocations * ; fixed: * ; Filename containing blanks passed as parm in batch mode (Explorer context) * ; added: * ; Export comments for spell checking (WinEdit, NoteTab Pro, ect) * ; Import spell-checked comments * ; Insert lines from a file * ; * ; v1.6 * ; * ; fixed: * ; Spell-checked comment only line. * ; Convert out-of-range line number to append for `Insert lines from a file` * ; * ; v1.7 * ; * ; fixed: * ; All comments now processed for spell-checking purposes. * ; added: * ; Original clipboard contents saved before, and restored after function. * ; Split file * ; Join files * ; * ; * ;***************************************************************************************** ;***************************************************************************************** ; * ; THIS SCRIPT HAS BEEN FORMATTED AND SYNTAXCHECKED BY SyntaxChecker v4.28. * ; * ; For more information, please contact the author via e-mail, subject 'SyntaxChecker'. * ; * ;***************************************************************************************** ;***************************************************************************************** vers="ScreenFileUtility v1.7" GOSUB INITUDFS GOSUB SAVEINPUT GOSUB REQUEST GOSUB PROCESSREQUEST EXIT ;-------------------------------------------------------------------------------------------------- :REQUEST ;{{{:REQUEST}}} Intcontrol(28,1,0,0,0) ; Fixed font. Intcontrol(63,100,10,890,990) ; Stretch panel. IF batchu THEN x=AskItemList(StrCat(vers," - ","File Utilities - UDF loaded count=",Intcontrol(77,90,0,0,0),", File: ",file1),batch,@Tab,@Unsorted,@Single) ; Get function name selected. ELSE x=AskItemList(StrCat(vers," - ","Screen Utilities - UDF loaded count=",Intcontrol(77,90,0,0,0)),screen,@Tab,@Unsorted,@Single) ; Get function name selected. sf=StrTrim(StrLower(StrSub(x,1,2))) ; Get function code. IF sf=="x" || x=="" || cancel THEN RETURN ; Exit/cancel - same thing here. IF StrSub(sf,1,1)==";" THEN GOTO REQUEST function=ItemExtract(sf,functs,@Tab) IF StrTrim(function)=="" THEN Message("Unimplemented function",x) THEN RETURN IF !ItemLocate(function,Intcontrol(77,103,0,0,0),@Tab) THEN GOSUB %FUNCTION% file3=%function%(batchu,file1) RETURN ;-------------------------------------------------------------------------------------------------- :PROCESSREQUEST ;{{{:PROCESSREQUEST}}} IF file3<>"" IF FileSize(file3)<>0 IF !batchu buf=BinaryAlloc(FileSize(file3)) BinaryRead(buf,file3) IF !crlf && BinaryPeekStr(buf,FileSize(file3)-2,2)==@CrLf THEN BinaryEodSet(buf,BinaryEodGet(buf)-2) ClipPut("") BinaryClipPut(buf,1) wPaste() BinaryFree(buf) ELSE Run(StrCat(DirHome(),"Browser.exe"),FileNameShort(file3)) ENDIF ELSE Run(StrCat(DirHome(),"Browser.exe"),FileNameShort(file3)) ENDIF ENDIF IF !batchu wGotoLine(linenum) wGotoCol(1) wClearSel() IF origcb THEN ClipPut(orig) THEN wStatusMsg("Original Clipboard contents restored") IF WinExist(`ClipMate `)THEN SendKeysTo("ClipMate","{F12}") THEN WinActivate(currwin) DROP(batch,batchu,buf,cancel,crlf,currwin,file1,file2,file3,function,functs,linenum) DROP(screen,sf,size,vers,x,xx) ENDIF RETURN ;-------------------------------------------------------------------------------------------------- :SAVEINPUT ;{{{:SAVEINPUT}}} IF batchu IF StrIndexNc(WinItemize(),StrCat(vers," - Select File"),1,@Fwdscan) THEN EXIT pin=StrLower(Intcontrol(1006,0,0,0,0)) ; Get virgin command line. x=StrIndex(pin,""" ",1,@Fwdscan) IF x THEN file1=StrTrim(StrSub(pin,x+1,-1)) ELSE file1=AskFileName(StrCat(vers," - Select File"),FilePath(Intcontrol(1004,0,0,0,0)),"All Files|*.*","*.*",1) ELSE IF ClipHasFormat(1) THEN orig=ClipGet() ; Save original clipboard contents. THEN origcb=1 THEN wStatusMsg("Original Clipboard contents saved") currwin=StrSub(WinGetActive(),1,StrLen(WinGetActive())-3) IF WinExist(`ClipMate `) THEN SendKeysTo("ClipMate","{F12}") file1=FileNameLong(FileCreateTemp("UF1")) batchu=0 linenum=1 IF !wGetSelState() THEN wSelectAll() ELSE linenum=wGetLineNo() wCopy() size=BinaryClipGet(0,1) buf=BinaryAlloc(size) BinaryClipGet(buf,1) IF size<3 THEN crlf=0 IF size>2 THEN IF BinaryPeekStr(buf,size-2,2)<>@CrLf THEN crlf=0 IF linenum<>1 THEN linenum=linenum-BinaryReplace(buf,@CrLf,@CrLf,1) BinaryWrite(buf,file1) BinaryFree(buf) ENDIF RETURN ;-------------------------------------------------------------------------------------------------- :INITUDFS ;{{{:INITUDFS}}} IF !ItemLocate("fmfilemath",Intcontrol(77,103,0,0,0),@Tab) THEN GOSUB PRELOAD ; Pre-load certain UDFs once only per session. ;@fmADD=1 ;@fmSUBTRACT=2 ;@fmOR=3 ;@fmXOR=4 ;@fmAND=5 file1="" file2="" file3="" Intcontrol(72,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. crlf=1 batchu=0 origcb=0 IF RtStatus()==1 || RtStatus()==0 THEN batchu=1 ; Interpreter or .exe. xx=0 functs="" IF batchu xx=xx+1 functs=StrCat(functs,"Datainformation",@Tab) batch=StrCat(StrFix(xx," ",4),"File - Data information",@Tab) xx=xx+1 functs=StrCat(functs,"Charactercount",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Character Count",@Tab) batch=StrCat(batch,"******************************* FileMath functions ******************************",@Tab) xx=xx+1 functs=StrCat(functs,"Sortascending",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Sort (Ascending)",@Tab) xx=xx+1 functs=StrCat(functs,"Sortdescending",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Sort (Descending)",@Tab) xx=xx+1 functs=StrCat(functs,"Removeduplicatelines",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Remove Duplicate lines",@Tab) xx=xx+1 functs=StrCat(functs,"Getduplicatelines",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Get Duplicate lines",@Tab) xx=xx+1 functs=StrCat(functs,"Addlines",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - ADD (Makes a combination of both input files. Not sorted. Dups may exist)",@Tab) xx=xx+1 functs=StrCat(functs,"Subtractlines",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - SUBTRACT (Subtracts line in second file from the first file. Sorted. Dups may exist)",@Tab) xx=xx+1 functs=StrCat(functs,"Orlines",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - OR (Returns lines found in both files. Sorted. No dups)",@Tab) xx=xx+1 functs=StrCat(functs,"Xorlines",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - XOR (Returns lines not found in both file)",@Tab) xx=xx+1 functs=StrCat(functs,"Andlines",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - AND (Returns lines only found in both files)",@Tab) batch=StrCat(batch,"******************************* Column manipulation functions ******************************",@Tab) xx=xx+1 functs=StrCat(functs,"ColumnSort",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Sort on column range",@Tab) xx=xx+1 functs=StrCat(functs,"ShiftColumns",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Shift columns",@Tab) xx=xx+1 functs=StrCat(functs,"DeleteColumns",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Delete columns",@Tab) xx=xx+1 functs=StrCat(functs,"SaveColumns",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Save columns",@Tab) xx=xx+1 functs=StrCat(functs,"InsertColumns",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Insert columns from file",@Tab) xx=xx+1 functs=StrCat(functs,"InsertData",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Insert columns",@Tab) xx=xx+1 functs=StrCat(functs,"replaceData",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Replace columns",@Tab) xx=xx+1 functs=StrCat(functs,"FindData",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Find data between columns",@Tab) batch=StrCat(batch,"******************************* Line manipulation functions ******************************",@Tab) xx=xx+1 functs=StrCat(functs,"Dropblanklines",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Drop blank lines",@Tab) xx=xx+1 functs=StrCat(functs,"Insertlines",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Insert lines from a file",@Tab) xx=xx+1 functs=StrCat(functs,"WrapLines",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Wrap lines",@Tab) xx=xx+1 functs=StrCat(functs,"CentreLines",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Centre/Align lines",@Tab) xx=xx+1 functs=StrCat(functs,"Appenddata",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Append data to lines",@Tab) xx=xx+1 functs=StrCat(functs,"Addscreenfiletofile",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Append file to a file",@Tab) xx=xx+1 functs=StrCat(functs,"Prependdata",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Prepend data to lines",@Tab) xx=xx+1 functs=StrCat(functs,"Removelead",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Remove leading character/s",@Tab) xx=xx+1 functs=StrCat(functs,"Removetrail",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Remove trailing character/s",@Tab) xx=xx+1 functs=StrCat(functs,"AllUpper",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - All upper case",@Tab) xx=xx+1 functs=StrCat(functs,"Alllower",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - All lower case",@Tab) xx=xx+1 functs=StrCat(functs,"Addlinenumbers",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Add line numbers",@Tab) batch=StrCat(batch,"******************************* Hex manipulation functions *******************************",@Tab) xx=xx+1 functs=StrCat(functs,"HextoHex",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Hex for Hex replacement",@Tab) xx=xx+1 functs=StrCat(functs,"HextoString",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Hex for String replacement",@Tab) xx=xx+1 functs=StrCat(functs,"StringtoHex",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - String for Hex replacement",@Tab) xx=xx+1 functs=StrCat(functs,"MultipleHex",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Multiple Hex deletions",@Tab) xx=xx+1 functs=StrCat(functs,"DisplayHex",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Display Hex",@Tab) batch=StrCat(batch,"******************************* Compares *******************************",@Tab) xx=xx+1 functs=StrCat(functs,"Compare2files",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Compare 2 files",@Tab) xx=xx+1 functs=StrCat(functs,"Comparedirectories",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Compare directories",@Tab) batch=StrCat(batch,"******************************* Spell checking *******************************",@Tab) xx=xx+1 functs=StrCat(functs,"Spellcheckdata",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Export comments for spell checking",@Tab) xx=xx+1 functs=StrCat(functs,"Spellcheckeddata",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Import spell-checked comments",@Tab) batch=StrCat(batch,"******************************* File handling *******************************",@Tab) xx=xx+1 functs=StrCat(functs,"Splitfile",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Split file",@Tab) xx=xx+1 functs=StrCat(functs,"Joinfiles",@Tab) batch=StrCat(batch,StrFix(xx," ",4),"File - Join files",@Tab) batch=StrCat(batch,"******************************* End of function list ******************************",@Tab) batch=StrCat(batch,@Tab,@Tab,"X Exit") ELSE xx=xx+1 functs=StrCat(functs,"Datainformation",@Tab) screen=StrCat(StrFix(xx," ",4),"Screen - Data information",@Tab) xx=xx+1 functs=StrCat(functs,"Charactercount",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Character Count",@Tab) screen=StrCat(screen,"******************************* FileMath functions ******************************",@Tab) xx=xx+1 functs=StrCat(functs,"Sortascending",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Sort (Ascending)",@Tab) xx=xx+1 functs=StrCat(functs,"Sortdescending",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Sort (Descending)",@Tab) xx=xx+1 functs=StrCat(functs,"Removeduplicatelines",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Remove Duplicate lines",@Tab) xx=xx+1 functs=StrCat(functs,"Getduplicatelines",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Get Duplicate lines",@Tab) xx=xx+1 functs=StrCat(functs,"Addlines",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - ADD (Makes a combination of both input files. Not sorted. Dups may exist)",@Tab) xx=xx+1 functs=StrCat(functs,"Subtractlines",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - SUBTRACT (Subtracts line in second file from the first file. Sorted. Dups may exist)",@Tab) xx=xx+1 functs=StrCat(functs,"Orlines",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - OR (Returns lines found in both files. Sorted. No dups)",@Tab) xx=xx+1 functs=StrCat(functs,"Xorlines",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - XOR (Returns lines not found in both file)",@Tab) xx=xx+1 functs=StrCat(functs,"Andlines",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - AND (Returns lines only found in both files)",@Tab) screen=StrCat(screen,"******************************* Column manipulation functions ******************************",@Tab) xx=xx+1 functs=StrCat(functs,"ColumnSort",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Sort on column range",@Tab) xx=xx+1 functs=StrCat(functs,"ShiftColumns",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Shift columns",@Tab) xx=xx+1 functs=StrCat(functs,"DeleteColumns",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Delete columns",@Tab) xx=xx+1 functs=StrCat(functs,"SaveColumns",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Save columns",@Tab) xx=xx+1 functs=StrCat(functs,"InsertColumns",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Insert columns from file",@Tab) xx=xx+1 functs=StrCat(functs,"InsertData",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Insert columns",@Tab) xx=xx+1 functs=StrCat(functs,"ReplaceData",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Replace columns",@Tab) xx=xx+1 functs=StrCat(functs,"FindData",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Find Data between columns",@Tab) screen=StrCat(screen,"******************************* Line manipulation functions ******************************",@Tab) xx=xx+1 functs=StrCat(functs,"DropBlankLines",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Drop blank lines",@Tab) xx=xx+1 functs=StrCat(functs,"Insertlines",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Insert lines from a file",@Tab) xx=xx+1 functs=StrCat(functs,"WrapLines",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Wrap lines",@Tab) xx=xx+1 functs=StrCat(functs,"CentreLines",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Centre/Align lines",@Tab) xx=xx+1 functs=StrCat(functs,"Appenddata",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Append data to lines",@Tab) xx=xx+1 functs=StrCat(functs,"Addscreenfiletofile",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Append screen data to a file",@Tab) xx=xx+1 functs=StrCat(functs,"Addscreenfiletonewfile",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Append screen data to a new file",@Tab) xx=xx+1 functs=StrCat(functs,"Prependdata",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Prepend data to lines",@Tab) xx=xx+1 functs=StrCat(functs,"Removelead",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Remove leading character/s",@Tab) xx=xx+1 functs=StrCat(functs,"Removetrail",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Remove trailing character/s",@Tab) xx=xx+1 functs=StrCat(functs,"AllUpper",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - All upper case",@Tab) xx=xx+1 functs=StrCat(functs,"Alllower",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - All lower case",@Tab) xx=xx+1 functs=StrCat(functs,"Addlinenumbers",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Add line numbers",@Tab) screen=StrCat(screen,"******************************* Hex manipulation functions *******************************",@Tab) xx=xx+1 functs=StrCat(functs,"HextoHex",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Hex for Hex replacement",@Tab) xx=xx+1 functs=StrCat(functs,"HextoString",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Hex for String replacement",@Tab) xx=xx+1 functs=StrCat(functs,"StringtoHex",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - String for Hex replacement",@Tab) xx=xx+1 functs=StrCat(functs,"MultipleHex",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Multiple Hex deletions",@Tab) xx=xx+1 functs=StrCat(functs,"DisplayHex",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Display Hex",@Tab) screen=StrCat(screen,"******************************* Compares ******************************",@Tab) xx=xx+1 functs=StrCat(functs,"Comparescreenfile",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Compare screen data to a file",@Tab) xx=xx+1 functs=StrCat(functs,"Compare2screens",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Compare 2 screen sections",@Tab) screen=StrCat(screen,"******************************* Spell checking *******************************",@Tab) xx=xx+1 functs=StrCat(functs,"Spellcheckdata",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Export comments for spell checking",@Tab) xx=xx+1 functs=StrCat(functs,"Spellcheckeddata",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Import spell-checked comments",@Tab) screen=StrCat(screen,"******************************* File handling *******************************",@Tab) xx=xx+1 functs=StrCat(functs,"Splitfile",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Split screen into files",@Tab) xx=xx+1 functs=StrCat(functs,"Joinfiles",@Tab) screen=StrCat(screen,StrFix(xx," ",4),"Screen - Add files to screen",@Tab) screen=StrCat(screen,"******************************* End of function list ******************************",@Tab) screen=StrCat(screen,@Tab,@Tab,"X Exit") ENDIF functs=StrLower(functs) RETURN ;------------------------------------------------------------------------------------------------------------ :DATAINFORMATION ;{{{:DATAINFORMATION}}} #DEFINEFUNCTION Datainformation(batchu,file1) ;{{{#DEFINEFUNCTION Datainformation}}} IF !batchu THEN wClearSel() sub1max1=0 ; Length of longest line. sub1max1l=0 ; Line # of longest line. sub1tbar=0 ; No of lines in file. sub1bx1=0 ; No of blanks. sub1tsf=0 ; Current line no. sub1f=FileOpen(file1,"Read") WHILE @True sub1line=FileRead(sub1f) IF sub1line=="*EOF*" THEN BREAK sub1tsf=sub1tsf+1 IF sub1max10 THEN line=StrCat(StrSub(line,1,nc9-1),StrSub(line,sc9,-1)) ; Old part, chop, remainder. ELSE line=StrSub(line,Abs(cm9)+1,-1) ; From 'cm9' rightwards. :WRITEOUT ;{{{:WRITEOUT}}} FileWrite(f3,line) ENDWHILE FileClose(f1) FileClose(f3) RETURN file3 :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :DELETECOLUMNS ;{{{:DELETECOLUMNS}}} #DEFINEFUNCTION Deletecolumns(batchu,file1) ;{{{#DEFINEFUNCTION Deletecolumns}}} Intcontrol(72,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. sc13=1 ec13=5 WHILE @True deleteformat=`WWWDLGED,5.0` deletecaption=`Delete Columns` deletex=300 deletey=50 deletewidth=85 deleteheight=78 deletenumcontrols=8 delete01=`2,4,100,DEFAULT,STATICTEXT,DEFAULT,"Delete columns:"` delete02=`2,16,100,DEFAULT,STATICTEXT,DEFAULT,"Enter start and end column"` delete03=`4,33,30,DEFAULT,STATICTEXT,DEFAULT,"Column x,y"` delete04=`32,30,15,DEFAULT,EDITBOX,Sc13,""` delete05=`50,30,15,DEFAULT,EDITBOX,Ec13,""` delete06=`01,58,20,DEFAULT,PUSHBUTTON,DEFAULT,"&Delete",1` delete07=`25,58,30,DEFAULT,PUSHBUTTON,DEFAULT,"&Save&&Del",3` delete08=`60,58,20,DEFAULT,PUSHBUTTON,DEFAULT,"&Exit",2` dbp=Dialog("Delete") IF cancel || dbp==2 THEN BREAK ; Cancel requested. IF !IsNumber(sc13) || !IsNumber(ec13) || sc13<1 || ec13 "" THEN FileClose(f4) THEN Message("Listing of DELETED columns",file4) RETURN file3 :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :SAVECOLUMNS ;{{{:SAVECOLUMNS}}} #DEFINEFUNCTION Savecolumns(batchu,file1) ;{{{#DEFINEFUNCTION Savecolumns}}} Intcontrol(72,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. sc13=1 ec13=5 WHILE @True saveformat=`WWWDLGED,5.0` savecaption=`Save Columns` savex=300 savey=50 savewidth=85 saveheight=78 savenumcontrols=7 save01=`2,4,100,DEFAULT,STATICTEXT,DEFAULT,"Save columns:"` save02=`2,16,100,DEFAULT,STATICTEXT,DEFAULT,"Enter start and end column"` save03=`4,33,30,DEFAULT,STATICTEXT,DEFAULT,"Column x,y"` save04=`32,30,15,DEFAULT,EDITBOX,Sc13,""` save05=`50,30,15,DEFAULT,EDITBOX,Ec13,""` save06=`01,58,20,DEFAULT,PUSHBUTTON,DEFAULT,"&Save",1` save07=`60,58,20,DEFAULT,PUSHBUTTON,DEFAULT,"&Exit",2` dbp=Dialog("Save") IF cancel || dbp==2 THEN BREAK ; Cancel requested. IF !IsNumber(sc13) || !IsNumber(ec13) || sc13<1 || ec13 "*EOF*" THEN GOSUB WRITE ELSE line4eof=1 ELSE line4="" ENDIF FileWrite(f3,line) ENDWHILE FileClose(f1) FileClose(f4) FileClose(f3) RETURN file3 :WRITE ;{{{:WRITE}}} line1=StrLen(line) ; Length of line receiving insert data. IF line1 "" THEN line=StrCat(line,StrFill(" ",sc17-line1)) ; Line short, pad it out first. IF !sc17 THEN line=StrCat(line4,line) ; Just join them if column is zero. ELSE line=StrCat(StrSub(line,1,sc17),line4,StrSub(line,sc17+1,-1)) ; Insert Line4 in between columns. RETURN :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;------------------------------------------------------------------------------------------------------------ :INSERTLINES ;{{{:INSERTLINES}}} #DEFINEFUNCTION Insertlines(batchu,file1) ;{{{#DEFINEFUNCTION Insertlines}}} Intcontrol(72,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. sc17=0 WHILE @True insertformat=`WWWDLGED,5.0` insertcaption=`Insert Lines` insertx=300 inserty=50 insertwidth=100 insertheight=78 insertnumcontrols=6 insert01=`2,4,100,DEFAULT,STATICTEXT,DEFAULT,"Insert after line x"` insert02=`4,15,50,DEFAULT,STATICTEXT,DEFAULT,"Note: 0 is start of file"` insert03=`4,33,30,DEFAULT,STATICTEXT,DEFAULT,"Line x"` insert04=`40,30,15,DEFAULT,EDITBOX,Sc17,""` insert05=`08,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Insert",1` insert06=`53,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Exit",2` ibp=Dialog("Insert") IF cancel || ibp==2 THEN BREAK ; Cancel requested. IF !IsNumber(sc17) THEN CONTINUE IF sc17<0 THEN CONTINUE BREAK ENDWHILE IF cancel || ibp==2 THEN RETURN "" ; Cancel requested. f1=FileOpen(file1,"Read") file4=AskFileName("Select file for Insert Lines",FileNameLong(Environment("TEMP")),"All Files|*.*|WIL Files|*.wbt;*.mnu|Text Files|*.txt|","UF4*.tmp",1) ; Get insert data file name. IF cancel THEN RETURN "" ; Cancel requested. f4=FileOpen(file4,"Read") file3=FileNameLong(FileCreateTemp("UF3")) f3=FileOpen(file3,"Write") line1=0 line4eof=0 line4="" WHILE @True line=FileRead(f1) IF line=="*EOF*" THEN BREAK IF line1==sc17 THEN GOSUB ADDLINES FileWrite(f3,line) line1=line1+1 ENDWHILE IF !line4eof THEN GOSUB ADDLINES FileClose(f1) FileClose(f4) FileClose(f3) RETURN file3 :ADDLINES ;{{{:ADDLINES}}} WHILE @True line4=FileRead(f4) IF line4=="*EOF*" THEN BREAK FileWrite(f3,line4) ENDWHILE line4eof=1 RETURN :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;------------------------------------------------------------------------------------------------------------ :INSERTDATA ;{{{:INSERTDATA}}} #DEFINEFUNCTION Insertdata(batchu,file1) ;{{{#DEFINEFUNCTION Insertdata}}} Intcontrol(72,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. sc17=1 WHILE @True insertformat=`WWWDLGED,5.0` insertcaption=`Insert Columns` insertx=300 inserty=50 insertwidth=100 insertheight=78 insertnumcontrols=6 insert01=`2,4,100,DEFAULT,STATICTEXT,DEFAULT,"Insert Data at column x "` insert02=`4,25,30,DEFAULT,STATICTEXT,DEFAULT,"Column x"` insert03=`40,22,15,DEFAULT,EDITBOX,Sc17,""` insert04=`10,40,70,DEFAULT,EDITBOX,Data,""` insert05=`08,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Insert",1` insert06=`53,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Exit",2` ibp=Dialog("Insert") IF cancel || ibp==2 THEN BREAK ; Cancel requested. IF !IsNumber(sc17) THEN CONTINUE IF sc17<1 THEN CONTINUE sc17=sc17-1 BREAK ENDWHILE IF cancel || ibp==2 || data=="" THEN RETURN "" ; Cancel requested. f1=FileOpen(file1,"Read") file3=FileNameLong(FileCreateTemp("UF3")) f3=FileOpen(file3,"Write") WHILE @True line=FileRead(f1) IF line=="*EOF*" THEN BREAK line1=StrLen(line) ; Length of line receiving insert data. IF line1 "` insert05=`08,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Replace",1` insert06=`53,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Exit",2` ibp=Dialog("Insert") IF cancel || ibp==2 THEN BREAK ; Cancel requested. IF !IsNumber(sc17) THEN CONTINUE IF sc17<1 THEN CONTINUE sc17=sc17-1 BREAK ENDWHILE IF cancel || ibp==2 || data=="" THEN RETURN "" ; Cancel requested. f1=FileOpen(file1,"Read") file3=FileNameLong(FileCreateTemp("UF3")) f3=FileOpen(file3,"Write") WHILE @True line=FileRead(f1) IF line=="*EOF*" THEN BREAK line1=StrLen(line) ; Length of line receiving replacement data. IF line1 2 || StrLen(hexb)<>2 || hexa=="00" || hexb=="00" THEN CONTINUE IF !StrScan(StrSub(hexa,1,1),hexs,1,@Fwdscan) || !StrScan(StrSub(hexa,2,1),hexs,1,@Fwdscan) THEN CONTINUE IF !StrScan(StrSub(hexb,1,1),hexs,1,@Fwdscan) || !StrScan(StrSub(hexb,2,1),hexs,1,@Fwdscan) THEN CONTINUE a=xBaseConvert(hexa,16,10) b=xBaseConvert(hexb,16,10) BREAK ENDWHILE IF cancel || hexc==2 THEN RETURN "" ; Cancel requested. f1=FileOpen(file1,"Read") file3=FileNameLong(FileCreateTemp("UF3")) f3=FileOpen(file3,"Write") WHILE @True line=FileRead(f1) IF line=="*EOF*" THEN BREAK FileWrite(f3,StrReplace(line,Num2Char(a),Num2Char(b))) ENDWHILE FileClose(f1) FileClose(f3) RETURN file3 :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :HEXTOSTRING ;{{{:HEXTOSTRING}}} #DEFINEFUNCTION Hextostring(batchu,file1) ;{{{#DEFINEFUNCTION Hextostring}}} IF !StrIndexNc(Intcontrol(77,42,0,0,0),"wilx34i.dll",1,@Fwdscan) THEN AddExtender("wilx34i.dll") Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. hexa="00" hexs="0123456789abcdef" hexb="" WHILE @True hexcformat=`WWWDLGED,5.0` hexccaption=`Hex String replacement` hexcx=450 hexcy=10 hexcwidth=100 hexcheight=78 hexcnumcontrols=7 hexc01=`2,4,160,DEFAULT,STATICTEXT,DEFAULT,"Replace Hex byte with string"` hexc02=`2,16,64,DEFAULT,STATICTEXT,DEFAULT,""` hexc03=`4,33,30,DEFAULT,STATICTEXT,DEFAULT,"Byte "` hexc04=`32,30,15,DEFAULT,EDITBOX,Hexa,""` hexc05=`50,30,40,DEFAULT,EDITBOX,Hexb,""` hexc06=`08,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Swap",1` hexc07=`53,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Exit",2` hexc=Dialog("Hexc") IF cancel || hexc==2 THEN BREAK ; Cancel requested. hexa=StrLower(hexa) IF StrLen(hexa)<>2 || hexa=="00" THEN CONTINUE IF !StrScan(StrSub(hexa,1,1),hexs,1,@Fwdscan) || !StrScan(StrSub(hexa,2,1),hexs,1,@Fwdscan) THEN CONTINUE a=xBaseConvert(hexa,16,10) BREAK ENDWHILE IF cancel || hexc==2 THEN RETURN "" ; Cancel requested. f1=FileOpen(file1,"Read") file3=FileNameLong(FileCreateTemp("UF3")) f3=FileOpen(file3,"Write") WHILE @True line=FileRead(f1) IF line=="*EOF*" THEN BREAK FileWrite(f3,StrReplace(line,Num2Char(a),hexb)) ; Swap byte with string. ENDWHILE FileClose(f1) FileClose(f3) RETURN file3 :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :STRINGTOHEX ;{{{:STRINGTOHEX}}} #DEFINEFUNCTION Stringtohex(batchu,file1) ;{{{#DEFINEFUNCTION Stringtohex}}} IF !StrIndexNc(Intcontrol(77,42,0,0,0),"wilx34i.dll",1,@Fwdscan) THEN AddExtender("wilx34i.dll") Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. hexa="" hexs="0123456789abcdef" WHILE @True hexcformat=`WWWDLGED,5.0` hexccaption=`String with hex replacement` hexcx=450 hexcy=10 hexcwidth=100 hexcheight=78 hexcnumcontrols=7 hexc01=`2,4,160,DEFAULT,STATICTEXT,DEFAULT,"Replace string with hex byte"` hexc02=`2,16,64,DEFAULT,STATICTEXT,DEFAULT,""` hexc03=`4,33,30,DEFAULT,STATICTEXT,DEFAULT,"String "` hexc04=`32,30,40,DEFAULT,EDITBOX,Hexa,""` hexc05=`75,30,20,DEFAULT,EDITBOX,Hexb,""` hexc06=`08,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Swap",1` hexc07=`53,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Exit",2` hexc=Dialog("Hexc") IF cancel || hexc==2 THEN BREAK ; Cancel requested. IF hexa=="" THEN CONTINUE hexb=StrLower(hexb) IF hexb=="" THEN BREAK IF StrLen(hexb)<>2 || hexb=="00" THEN CONTINUE IF !StrScan(StrSub(hexb,1,1),hexs,1,@Fwdscan) || !StrScan(StrSub(hexb,2,1),hexs,1,@Fwdscan) THEN CONTINUE b=xBaseConvert(hexb,16,10) BREAK ENDWHILE IF cancel || hexc==2 THEN RETURN "" ; Cancel requested. f1=FileOpen(file1,"Read") file3=FileNameLong(FileCreateTemp("UF3")) f3=FileOpen(file3,"Write") WHILE @True line=FileRead(f1) IF line=="*EOF*" THEN BREAK IF hexb<>"" THEN FileWrite(f3,StrReplace(StrLower(line),StrLower(hexa),Num2Char(b))) ; Replace string with hex byte. ELSE FileWrite(f3,StrReplace(StrLower(line),StrLower(hexa),"")) ; Delete string. ENDWHILE FileClose(f1) FileClose(f3) RETURN file3 :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :MULTIPLEHEX ;{{{:MULTIPLEHEX}}} #DEFINEFUNCTION Multiplehex(batchu,file1) ;{{{#DEFINEFUNCTION Multiplehex}}} Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. Intcontrol(28,1,0,0,0) ; Fixed font. Intcontrol(63,200,10,690,990) ; Stretch panel. Intcontrol(72,2,0,0,0) ; Cancel and return. x="" ; Init. hexdel=StrCat ("01 001 ",Num2Char(001)," ",@Tab,"02 002 ",Num2Char(002)," ",@Tab,"03 003 ",Num2Char(003)," ",@Tab) hexdel=StrCat(hexdel,"04 004 ",Num2Char(004)," ",@Tab,"05 005 ",Num2Char(005)," ",@Tab,"06 006 ",Num2Char(006)," ",@Tab,"07 007 ",Num2Char(007)," ",@Tab) hexdel=StrCat(hexdel,"08 008 ",Num2Char(008)," ",@Tab,"09 009 ","@tab " ,@Tab,"0a 010 ","@lf " ,@Tab,"0b 011 ",Num2Char(011)," ",@Tab) hexdel=StrCat(hexdel,"0c 012 ",Num2Char(012)," ",@Tab,"0d 013 ","@cr " ,@Tab,"0e 014 ",Num2Char(014)," ",@Tab,"0f 015 ",Num2Char(015)," ",@Tab) hexdel=StrCat(hexdel,"10 016 ",Num2Char(016)," ",@Tab,"11 017 ",Num2Char(017)," ",@Tab,"12 018 ",Num2Char(018)," ",@Tab,"13 019 ",Num2Char(019)," ",@Tab) hexdel=StrCat(hexdel,"14 020 ",Num2Char(020)," ",@Tab,"15 021 ",Num2Char(021)," ",@Tab,"16 022 ",Num2Char(022)," ",@Tab,"17 023 ",Num2Char(023)," ",@Tab) hexdel=StrCat(hexdel,"18 024 ",Num2Char(024)," ",@Tab,"19 025 ",Num2Char(025)," ",@Tab,"1a 026 ",Num2Char(026)," ",@Tab,"1b 027 ",Num2Char(027)," ",@Tab) hexdel=StrCat(hexdel,"1c 028 ",Num2Char(028)," ",@Tab,"1d 029 ",Num2Char(029)," ",@Tab,"1e 030 ",Num2Char(030)," ",@Tab,"1f 031 ",Num2Char(031)," ",@Tab) hexdel=StrCat(hexdel,"20 032 ",Num2Char(032),"Blnk ",@Tab,"21 033 ",Num2Char(033)," ",@Tab,"22 034 ",Num2Char(034)," ",@Tab,"23 035 ",Num2Char(035)," ",@Tab) hexdel=StrCat(hexdel,"24 036 ",Num2Char(036)," ",@Tab,"25 037 ",Num2Char(037)," ",@Tab,"26 038 ",Num2Char(038)," ",@Tab,"27 039 ",Num2Char(039)," ",@Tab) hexdel=StrCat(hexdel,"28 040 ",Num2Char(040)," ",@Tab,"29 041 ",Num2Char(041)," ",@Tab,"2a 042 ",Num2Char(042)," ",@Tab,"2b 043 ",Num2Char(043)," ",@Tab) hexdel=StrCat(hexdel,"2c 044 ",Num2Char(044)," ",@Tab,"2d 045 ",Num2Char(045)," ",@Tab,"2e 046 ",Num2Char(046)," ",@Tab,"2f 047 ",Num2Char(047)," ",@Tab) hexdel=StrCat(hexdel,"30 048 ",Num2Char(048)," ",@Tab,"31 049 ",Num2Char(049)," ",@Tab,"32 050 ",Num2Char(050)," ",@Tab,"33 051 ",Num2Char(051)," ",@Tab) hexdel=StrCat(hexdel,"34 052 ",Num2Char(052)," ",@Tab,"35 053 ",Num2Char(053)," ",@Tab,"36 054 ",Num2Char(054)," ",@Tab,"37 055 ",Num2Char(055)," ",@Tab) hexdel=StrCat(hexdel,"38 056 ",Num2Char(056)," ",@Tab,"39 057 ",Num2Char(057)," ",@Tab,"3a 058 ",Num2Char(058)," ",@Tab,"3b 059 ",Num2Char(059)," ",@Tab) hexdel=StrCat(hexdel,"3c 060 ",Num2Char(060)," ",@Tab,"3d 061 ",Num2Char(061)," ",@Tab,"3e 062 ",Num2Char(062)," ",@Tab,"3f 063 ",Num2Char(063)," ",@Tab) hexdel=StrCat(hexdel,"40 064 ",Num2Char(064)," ",@Tab,"41 065 ",Num2Char(065)," ",@Tab,"42 066 ",Num2Char(066)," ",@Tab,"43 067 ",Num2Char(067)," ",@Tab) hexdel=StrCat(hexdel,"44 068 ",Num2Char(068)," ",@Tab,"45 069 ",Num2Char(069)," ",@Tab,"46 070 ",Num2Char(070)," ",@Tab,"47 071 ",Num2Char(071)," ",@Tab) hexdel=StrCat(hexdel,"48 072 ",Num2Char(072)," ",@Tab,"49 073 ",Num2Char(073)," ",@Tab,"4a 074 ",Num2Char(074)," ",@Tab,"4b 075 ",Num2Char(075)," ",@Tab) hexdel=StrCat(hexdel,"4c 076 ",Num2Char(076)," ",@Tab,"4d 077 ",Num2Char(077)," ",@Tab,"4e 078 ",Num2Char(078)," ",@Tab,"4f 079 ",Num2Char(079)," ",@Tab) hexdel=StrCat(hexdel,"50 080 ",Num2Char(080)," ",@Tab,"51 081 ",Num2Char(081)," ",@Tab,"52 082 ",Num2Char(082)," ",@Tab,"53 083 ",Num2Char(083)," ",@Tab) hexdel=StrCat(hexdel,"54 084 ",Num2Char(084)," ",@Tab,"55 085 ",Num2Char(085)," ",@Tab,"56 086 ",Num2Char(086)," ",@Tab,"57 087 ",Num2Char(087)," ",@Tab) hexdel=StrCat(hexdel,"58 088 ",Num2Char(088)," ",@Tab,"59 089 ",Num2Char(089)," ",@Tab,"5a 090 ",Num2Char(090)," ",@Tab,"5b 091 ",Num2Char(091)," ",@Tab) hexdel=StrCat(hexdel,"5c 092 ",Num2Char(092)," ",@Tab,"5d 093 ",Num2Char(093)," ",@Tab,"5e 094 ",Num2Char(094)," ",@Tab,"5f 095 ",Num2Char(095)," ",@Tab) hexdel=StrCat(hexdel,"60 096 ",Num2Char(096)," ",@Tab,"61 097 ",Num2Char(097)," ",@Tab,"62 098 ",Num2Char(098)," ",@Tab,"63 099 ",Num2Char(099)," ",@Tab) hexdel=StrCat(hexdel,"64 100 ",Num2Char(100)," ",@Tab,"65 101 ",Num2Char(101)," ",@Tab,"66 102 ",Num2Char(102)," ",@Tab,"67 103 ",Num2Char(103)," ",@Tab) hexdel=StrCat(hexdel,"68 104 ",Num2Char(104)," ",@Tab,"69 105 ",Num2Char(105)," ",@Tab,"6a 106 ",Num2Char(106)," ",@Tab,"6b 107 ",Num2Char(107)," ",@Tab) hexdel=StrCat(hexdel,"6c 108 ",Num2Char(108)," ",@Tab,"6d 109 ",Num2Char(109)," ",@Tab,"6e 110 ",Num2Char(110)," ",@Tab,"6f 111 ",Num2Char(111)," ",@Tab) hexdel=StrCat(hexdel,"70 112 ",Num2Char(112)," ",@Tab,"71 113 ",Num2Char(113)," ",@Tab,"72 114 ",Num2Char(114)," ",@Tab,"73 115 ",Num2Char(115)," ",@Tab) hexdel=StrCat(hexdel,"74 116 ",Num2Char(116)," ",@Tab,"75 117 ",Num2Char(117)," ",@Tab,"76 118 ",Num2Char(118)," ",@Tab,"77 119 ",Num2Char(119)," ",@Tab) hexdel=StrCat(hexdel,"78 120 ",Num2Char(120)," ",@Tab,"79 121 ",Num2Char(121)," ",@Tab,"7a 122 ",Num2Char(122)," ",@Tab,"7b 123 ",Num2Char(123)," ",@Tab) hexdel=StrCat(hexdel,"7c 124 ",Num2Char(124)," ",@Tab,"7d 125 ",Num2Char(125)," ",@Tab,"7e 126 ",Num2Char(126)," ",@Tab,"7f 127 ",Num2Char(127)," ",@Tab) hexdel=StrCat(hexdel,"80 128 ",Num2Char(128)," ",@Tab,"81 129 ",Num2Char(129)," ",@Tab,"82 130 ",Num2Char(130)," ",@Tab,"83 131 ",Num2Char(131)," ",@Tab) hexdel=StrCat(hexdel,"84 132 ",Num2Char(132)," ",@Tab,"85 133 ",Num2Char(133)," ",@Tab,"86 134 ",Num2Char(134)," ",@Tab,"87 135 ",Num2Char(135)," ",@Tab) hexdel=StrCat(hexdel,"88 136 ",Num2Char(136)," ",@Tab,"89 137 ",Num2Char(137)," ",@Tab,"8a 138 ",Num2Char(138)," ",@Tab,"8b 139 ",Num2Char(139)," ",@Tab) hexdel=StrCat(hexdel,"8c 140 ",Num2Char(140)," ",@Tab,"8d 141 ",Num2Char(141)," ",@Tab,"8e 142 ",Num2Char(142)," ",@Tab,"8f 143 ",Num2Char(143)," ",@Tab) hexdel=StrCat(hexdel,"90 144 ",Num2Char(144)," ",@Tab,"91 145 ",Num2Char(145)," ",@Tab,"92 146 ",Num2Char(146)," ",@Tab,"93 147 ",Num2Char(147)," ",@Tab) hexdel=StrCat(hexdel,"94 148 ",Num2Char(148)," ",@Tab,"95 149 ",Num2Char(149)," ",@Tab,"96 150 ",Num2Char(150)," ",@Tab,"97 151 ",Num2Char(151)," ",@Tab) hexdel=StrCat(hexdel,"98 152 ",Num2Char(152)," ",@Tab,"99 153 ",Num2Char(153)," ",@Tab,"9a 154 ",Num2Char(154)," ",@Tab,"9b 155 ",Num2Char(155)," ",@Tab) hexdel=StrCat(hexdel,"9c 156 ",Num2Char(156)," ",@Tab,"9d 157 ",Num2Char(157)," ",@Tab,"9e 158 ",Num2Char(158)," ",@Tab,"9f 159 ",Num2Char(159)," ",@Tab) hexdel=StrCat(hexdel,"a0 160 ",Num2Char(160)," ",@Tab,"a1 161 ",Num2Char(161)," ",@Tab,"a2 162 ",Num2Char(162)," ",@Tab,"a3 163 ",Num2Char(163)," ",@Tab) hexdel=StrCat(hexdel,"a4 164 ",Num2Char(164)," ",@Tab,"a5 165 ",Num2Char(165)," ",@Tab,"a6 166 ",Num2Char(166)," ",@Tab,"a7 167 ",Num2Char(167)," ",@Tab) hexdel=StrCat(hexdel,"a8 168 ",Num2Char(168)," ",@Tab,"a9 169 ",Num2Char(169)," ",@Tab,"aa 170 ",Num2Char(170)," ",@Tab,"ab 171 ",Num2Char(171)," ",@Tab) hexdel=StrCat(hexdel,"ac 172 ",Num2Char(172)," ",@Tab,"ad 173 ",Num2Char(173)," ",@Tab,"ae 174 ",Num2Char(174)," ",@Tab,"af 175 ",Num2Char(175)," ",@Tab) hexdel=StrCat(hexdel,"b0 176 ",Num2Char(176)," ",@Tab,"b1 177 ",Num2Char(177)," ",@Tab,"b2 178 ",Num2Char(178)," ",@Tab,"b3 179 ",Num2Char(179)," ",@Tab) hexdel=StrCat(hexdel,"b4 180 ",Num2Char(180)," ",@Tab,"b5 181 ",Num2Char(181)," ",@Tab,"b6 182 ",Num2Char(182)," ",@Tab,"b7 183 ",Num2Char(183)," ",@Tab) hexdel=StrCat(hexdel,"b8 184 ",Num2Char(184)," ",@Tab,"b9 185 ",Num2Char(185)," ",@Tab,"ba 186 ",Num2Char(186)," ",@Tab,"bb 187 ",Num2Char(187)," ",@Tab) hexdel=StrCat(hexdel,"bc 188 ",Num2Char(188)," ",@Tab,"bd 189 ",Num2Char(189)," ",@Tab,"be 190 ",Num2Char(190)," ",@Tab,"bf 191 ",Num2Char(191)," ",@Tab) hexdel=StrCat(hexdel,"c0 192 ",Num2Char(192)," ",@Tab,"c1 193 ",Num2Char(193)," ",@Tab,"c2 194 ",Num2Char(194)," ",@Tab,"c3 195 ",Num2Char(195)," ",@Tab) hexdel=StrCat(hexdel,"c4 196 ",Num2Char(196)," ",@Tab,"c5 197 ",Num2Char(197)," ",@Tab,"c6 198 ",Num2Char(198)," ",@Tab,"c7 199 ",Num2Char(199)," ",@Tab) hexdel=StrCat(hexdel,"c8 200 ",Num2Char(200)," ",@Tab,"c9 201 ",Num2Char(201)," ",@Tab,"ca 202 ",Num2Char(202)," ",@Tab,"cb 203 ",Num2Char(203)," ",@Tab) hexdel=StrCat(hexdel,"cc 204 ",Num2Char(204)," ",@Tab,"cd 205 ",Num2Char(205)," ",@Tab,"ce 206 ",Num2Char(206)," ",@Tab,"cf 207 ",Num2Char(207)," ",@Tab) hexdel=StrCat(hexdel,"d0 208 ",Num2Char(208)," ",@Tab,"d1 209 ",Num2Char(209)," ",@Tab,"d2 210 ",Num2Char(210)," ",@Tab,"d3 211 ",Num2Char(211)," ",@Tab) hexdel=StrCat(hexdel,"d4 212 ",Num2Char(212)," ",@Tab,"d5 213 ",Num2Char(213)," ",@Tab,"d6 214 ",Num2Char(214)," ",@Tab,"d7 215 ",Num2Char(215)," ",@Tab) hexdel=StrCat(hexdel,"d8 216 ",Num2Char(216)," ",@Tab,"d9 217 ",Num2Char(217)," ",@Tab,"da 218 ",Num2Char(218)," ",@Tab,"db 219 ",Num2Char(219)," ",@Tab) hexdel=StrCat(hexdel,"dc 220 ",Num2Char(220)," ",@Tab,"dd 221 ",Num2Char(221)," ",@Tab,"de 222 ",Num2Char(222)," ",@Tab,"df 223 ",Num2Char(223)," ",@Tab) hexdel=StrCat(hexdel,"e0 224 ",Num2Char(224)," ",@Tab,"e1 225 ",Num2Char(225)," ",@Tab,"e2 226 ",Num2Char(226)," ",@Tab,"e3 227 ",Num2Char(227)," ",@Tab) hexdel=StrCat(hexdel,"e4 228 ",Num2Char(228)," ",@Tab,"e5 229 ",Num2Char(229)," ",@Tab,"e6 230 ",Num2Char(230)," ",@Tab,"e7 231 ",Num2Char(231)," ",@Tab) hexdel=StrCat(hexdel,"e8 232 ",Num2Char(232)," ",@Tab,"e9 233 ",Num2Char(233)," ",@Tab,"ea 234 ",Num2Char(234)," ",@Tab,"eb 235 ",Num2Char(235)," ",@Tab) hexdel=StrCat(hexdel,"ec 236 ",Num2Char(236)," ",@Tab,"ed 237 ",Num2Char(237)," ",@Tab,"ee 238 ",Num2Char(238)," ",@Tab,"ef 239 ",Num2Char(239)," ",@Tab) hexdel=StrCat(hexdel,"f0 240 ",Num2Char(240)," ",@Tab,"f1 241 ",Num2Char(241)," ",@Tab,"f2 242 ",Num2Char(242)," ",@Tab,"f3 243 ",Num2Char(243)," ",@Tab) hexdel=StrCat(hexdel,"f4 244 ",Num2Char(244)," ",@Tab,"f5 245 ",Num2Char(245)," ",@Tab,"f6 246 ",Num2Char(246)," ",@Tab,"f7 247 ",Num2Char(247)," ",@Tab) hexdel=StrCat(hexdel,"f8 248 ",Num2Char(248)," ",@Tab,"f9 249 ",Num2Char(249)," ",@Tab,"fa 250 ",Num2Char(250)," ",@Tab,"fb 251 ",Num2Char(251)," ",@Tab) hexdel=StrCat(hexdel,"fc 252 ",Num2Char(252)," ",@Tab,"fd 253 ",Num2Char(253)," ",@Tab,"fe 254 ",Num2Char(254)," ",@Tab,"ff 255 ",Num2Char(255)," ") x=AskItemList("Select hex byte/s to be deleted ",hexdel,@Tab,@Unsorted,@Multiple) ; Get hex bytes for deletion. IF x==0 || cancel THEN RETURN "" ; Exit/cancel - same thing here. buf=BinaryAlloc(FileSize(file1)) BinaryRead(buf,file1) file3=FileNameLong(FileCreateTemp("UF3")) c=0 FOR y=1 TO ItemCount(x,@Tab) z=StrSub(ItemExtract(y,x,@Tab),4,3) c=c+BinaryReplace(buf,Num2Char(z),"",1) NEXT BinaryWrite(buf,file3) BinaryFree(buf) Display(3,"Multiple Hex deletions","Number of characters dropped: %c%") RETURN file3 :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :DISPLAYHEX ;{{{:DISPLAYHEX}}} #DEFINEFUNCTION Displayhex(batchu,file1) ;{{{#DEFINEFUNCTION Displayhex}}} Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. browser=StrCat(DirHome(),"Browser.exe") IF FileExist(browser)<>1 THEN browser=StrLower(AskFileName("Browser not found - Select a Browser for hex viewing", DirHome(),"Program|*.exe|All Files|*.*|", "*.exe", 1)) ; Get a hex browser. IF cancel THEN RETURN "" Run(`%Browser%`,FileNameShort(file1)) ; Call Browser for 'work' file. IF StrLower(browser)==StrLower(StrCat(DirHome(),"browser.exe")) THEN WinWaitExist("~Browser - ",5) ; Wait for it... THEN SendMenusTo("~Browser - ", "View Hex") ; Select Hex view option. RETURN "" :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :FINDDATA ;{{{:FINDDATA}}} #DEFINEFUNCTION Finddata(batchu,file1) ;{{{#DEFINEFUNCTION Finddata}}} Intcontrol(72,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. sc19=1 ec19=10 find19=" " WHILE @True findformat=`WWWDLGED,5.0` findcaption=`Find between Columns` findx=200 findy=10 findwidth=100 findheight=94 findnumcontrols=7 find01=`2,4,100,DEFAULT,STATICTEXT,DEFAULT,"Find between columns:"` find02=`4,33,30,DEFAULT,STATICTEXT,DEFAULT,"Column x,y"` find03=`32,30,15,DEFAULT,EDITBOX,Sc19,""` find04=`50,30,15,DEFAULT,EDITBOX,Ec19,""` find05=`02,56,96,DEFAULT,EDITBOX,Find19,""` find06=`08,74,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Find",1` find07=`53,74,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Exit",2` fbp=Dialog("Find") IF cancel || fbp==2 THEN BREAK ; Cancel requested. IF !IsNumber(sc19) || !IsNumber(ec19) || sc19<1 || ec19 2 THEN CONTINUE IF (hexa>0 && hexb<>"") || (hexa==0 && StrTrim(hexb)=="") THEN CONTINUE hexb=StrTrim(StrLower(hexb)) BREAK ENDWHILE IF cancel || hexc==2 THEN RETURN "" ; Cancel requested. f1=FileOpen(file1,"Read") file3=FileNameLong(FileCreateTemp("UF3")) f3=FileOpen(file3,"Write") WHILE @True line=FileRead(f1) IF line=="*EOF*" THEN BREAK x=StrScan(line,listrf,1,@Fwdscan) IF hexa IF x==1 THEN FileWrite(f3,StrCat(StrSub(line,hexa+1,-1))) ELSE FileWrite(f3,StrCat(StrSub(line,1,x-1),StrSub(line,x+hexa,-1))) ELSE IF StrSub(StrLower(line),x,StrLen(hexb))==hexb IF x==1 THEN FileWrite(f3,StrCat(StrSub(line,StrLen(hexb)+1,-1))) ELSE FileWrite(f3,StrCat(StrSub(line,1,x-1),StrSub(line,x+StrLen(hexb),-1))) ELSE FileWrite(f3,line) ENDIF ENDIF ENDWHILE FileClose(f1) FileClose(f3) RETURN file3 :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :REMOVETRAIL ;{{{:REMOVETRAIL}}} #DEFINEFUNCTION Removetrail(batchu,file1) ;{{{#DEFINEFUNCTION Removetrail}}} listrf="abcdefghijklmnopqrstuvwxyzßàáâãäåæçèéêëìíîïðñòóôõöøùúûüýABCDEFGHIJKLMNOPQRSTUVWXYZÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ`¦¬1234567890-=!£$%%^&*()_+€[{]}:'@#~,<.>/?\|;""" ; Non blank chars. Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. WHILE @True hexa=0 hexb="" hexcformat=`WWWDLGED,5.0` hexccaption=`Remove trailing character/s` hexcx=250 hexcy=10 hexcwidth=100 hexcheight=78 hexcnumcontrols=7 hexc01=`2,4,060,DEFAULT,STATICTEXT,DEFAULT,"Remove # of trailing character/s"` hexc02=`60,4,20,DEFAULT,EDITBOX,Hexa,""` hexc03=`50,20,35,DEFAULT,STATICTEXT,DEFAULT,"- OR -"` hexc04=`2,30,060,DEFAULT,STATICTEXT,DEFAULT,"Remove trailing character/s"` hexc05=`60,30,30,DEFAULT,EDITBOX,Hexb,""` hexc06=`08,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Remove",1` hexc07=`53,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Exit",2` hexc=Dialog("Hexc") IF cancel || hexc==2 THEN BREAK ; Cancel requested. IF !IsInt(hexa) || VarType(hexb)<>2 THEN CONTINUE IF (hexa>0 && hexb<>"") || (hexa==0 && StrTrim(hexb)=="") THEN CONTINUE hexb=StrTrim(StrLower(hexb)) BREAK ENDWHILE IF cancel || hexc==2 THEN RETURN "" ; Cancel requested. f1=FileOpen(file1,"Read") file3=FileNameLong(FileCreateTemp("UF3")) f3=FileOpen(file3,"Write") WHILE @True line=FileRead(f1) IF line=="*EOF*" THEN BREAK x=StrScan(line,listrf,StrLen(line),@Backscan) line=StrSub(line,1,x) IF hexa FileWrite(f3,StrSub(line,1,x-hexa)) ELSE IF StrSub(StrLower(line),StrLen(line)-StrLen(hexb)+1,StrLen(hexb))==hexb THEN FileWrite(f3,StrSub(line,1,StrLen(line)-StrLen(hexb))) ELSE FileWrite(f3,line) ENDIF ENDWHILE FileClose(f1) FileClose(f3) RETURN file3 :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :ALLUPPER ;{{{:ALLUPPER}}} #DEFINEFUNCTION Allupper(batchu,file1) ;{{{#DEFINEFUNCTION Allupper}}} f1=FileOpen(file1,"Read") file3=FileNameLong(FileCreateTemp("UF3")) f3=FileOpen(file3,"Write") WHILE @True line=FileRead(f1) IF line=="*EOF*" THEN BREAK FileWrite(f3,StrUpper(line)) ENDWHILE FileClose(f1) FileClose(f3) RETURN file3 #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :ALLLOWER ;{{{:ALLLOWER}}} #DEFINEFUNCTION Alllower(batchu,file1) ;{{{#DEFINEFUNCTION Alllower}}} f1=FileOpen(file1,"Read") file3=FileNameLong(FileCreateTemp("UF3")) f3=FileOpen(file3,"Write") WHILE @True line=FileRead(f1) IF line=="*EOF*" THEN BREAK FileWrite(f3,StrLower(line)) ENDWHILE FileClose(f1) FileClose(f3) RETURN file3 #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :COMPARE2FILES ;{{{:COMPARE2FILES}}} #DEFINEFUNCTION Compare2files(batchu,file1) ;{{{#DEFINEFUNCTION Compare2files}}} Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. files=StrCat("*.",FileExtension(file1)) types="All Files|*.*|WIL Files|*.wbt;*.mnu|Text Files|*.txt|" file2=AskFileName("Select second file name for compare",FilePath(file1),types,files,1) IF cancel || file2=="" THEN RETURN "" xxcx=FileCompare(file1,file2)+3 ; Compare files and adjust return code. IF xxcx==3 ; Identical? Message("Files",StrCat(file1,@CrLf,file2,@CrLf,@CrLf,"are identical")) ; Say so. ELSE Compareresults(xxcx,file1,file2) ENDIF RETURN "" :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :COMPARESCREENFILE ;{{{:COMPARESCREENFILE}}} #DEFINEFUNCTION Comparescreenfile(batchu,file1) ;{{{#DEFINEFUNCTION Comparescreenfile}}} Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. files=StrCat("*.",FileExtension(file1)) types="All Files|*.*|WIL Files|*.wbt;*.mnu|Text Files|*.txt|" file2=AskFileName("Select file name for compare",FilePath(file1),types,files,1) IF cancel || file2=="" THEN RETURN "" xxcx=FileCompare(file1,file2)+3 ; Compare files and adjust return code. IF xxcx==3 ; Identical? Message("Screen and file",StrCat(file1,@CrLf,file2,@CrLf,@CrLf,"are identical")) ; Say so. ELSE Compareresults(xxcx,file1,file2) ENDIF RETURN "" :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :COMPARE2SCREENS ;{{{:COMPARE2SCREENS}}} #DEFINEFUNCTION Compare2screens(batchu,file1) ;{{{#DEFINEFUNCTION Compare2screens}}} step1="Next..." step2="Highlight new section of screen" step3="Re-invoke ScreenFileUtility & select 'Compare screen data to a file' option" step4="For file select '%file1%'" Message("Screen data saved",StrCat(step1,@CrLf,step2,@CrLf,step3,@CrLf,step4)) RETURN "" #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :COMPAREDIRECTORIES ;{{{:COMPAREDIRECTORIES}}} #DEFINEFUNCTION Comparedirectories(batchu,file1) ;{{{#DEFINEFUNCTION Comparedirectories}}} Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. file2=AskFileName("Select any file to obtain second directory","*.*","*.*","*.*",1) IF cancel || file2=="" THEN RETURN "" x=AskYesNo(StrCat(FilePath(file1),"-",FilePath(file2)),"Include subdirectories?") IF cancel THEN RETURN "" IF x THEN x=-1 ELSE x=-2 Compareresults(x,file1,file2) RETURN "" :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :ADDLINENUMBERS ;{{{:ADDLINENUMBERS}}} #DEFINEFUNCTION Addlinenumbers(batchu,file1) ;{{{#DEFINEFUNCTION Addlinenumbers}}} Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. start_num=10 inc=10 WHILE @True addnumsformat='WWWDLGED,5.0' addnumscaption='Add Line Numbers' addnumsx=200 addnumsy=100 addnumswidth=90 addnumsheight=50 addnumsnumcontrols=6 addnums01='4,6,44,DEFAULT,STATICTEXT,DEFAULT,"Starting Number: "' addnums02='4,20,44,DEFAULT,STATICTEXT,DEFAULT,"Increment: "' addnums03='48,4,36,DEFAULT,EDITBOX,start_num,""' addnums04='48,18,36,DEFAULT,EDITBOX,inc,""' addnums05='48,34,36,DEFAULT,PUSHBUTTON,DEFAULT,"Start",1' addnums06='4,34,36,DEFAULT,PUSHBUTTON,DEFAULT,"Cancel",0' addnums=Dialog("AddNums") IF cancel || addnums==0 THEN BREAK ; Cancel requested. IF !IsInt(start_num) || !IsInt(inc) THEN CONTINUE IF start_num<1 || inc<1 THEN CONTINUE BREAK ENDWHILE IF cancel || addnums==0 THEN RETURN "" ; Cancel requested. f1=FileOpen(file1,"Read") file3=FileNameLong(FileCreateTemp("UF3")) f3=FileOpen(file3,"Write") WHILE @True line=FileRead(f1) IF line=="*EOF*" THEN BREAK IF StrTrim(line)=="" FileWrite(f3,line) ELSE line=StrCat(StrFix(start_num," ",7),line) FileWrite(f3,line) start_num=start_num+inc ENDIF ENDWHILE FileClose(f1) FileClose(f3) RETURN file3 :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :ADDSCREENFILETOFILE ;{{{:ADDSCREENFILETOFILE}}} #DEFINEFUNCTION Addscreenfiletofile(batchu,file1) ;{{{#DEFINEFUNCTION Addscreenfiletofile}}} Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. file2=AskFileName("Select second file","*.*","*.*","*.*",1) IF cancel || file2=="" THEN RETURN "" IF StrLower(file1)==StrLower(file2) THEN Message("Same files!",StrCat("File1: ",file1,@CrLf,"File2: ",file2,@CrLf,@CrLf,"are identical!")) THEN RETURN"" IF FileSize(file2) buf=BinaryAlloc(FileSize(file2)+2) BinaryRead(buf,file2) IF FileSize(file2)<2 THEN BinaryPokeStr(buf,FileSize(file2),@CrLf) IF BinaryPeekStr(buf,BinaryEodGet(buf)-2,2)<>@CrLf THEN BinaryPokeStr(buf,FileSize(file2),@CrLf) BinaryWrite(buf,file2) BinaryFree(buf) ENDIF FileAppend(file1,file2) ; Add first file to second file. RETURN "" :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :ADDSCREENFILETONEWFILE ;{{{:ADDSCREENFILETONEWFILE}}} #DEFINEFUNCTION Addscreenfiletonewfile(batchu,file1) ;{{{#DEFINEFUNCTION Addscreenfiletonewfile}}} Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. file2=AskFileName("Select a new file for screen data","*.*","*.*","*.*",0) IF cancel || file2=="" THEN RETURN "" FileAppend(file1,file2) ; Add first file to second file. RETURN "" :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :SPELLCHECKDATA ;{{{:SPELLCHECKDATA}}} #DEFINEFUNCTION Spellcheckdata(batchu,file1) ;{{{#DEFINEFUNCTION Spellcheckdata}}} f1=FileOpen(file1,"Read") file3=FileNameLong(FileCreateTemp("UF5")) f3=FileOpen(file3,"Write") IF batchu THEN FileWrite(f3,file1) ELSE wFileSave() ELSE FileWrite(f3,wGetFileName()) linenum=1 WHILE @True line=FileRead(f1) IF line=="*EOF*" THEN BREAK x=Spellcheckcomment(line) IF x IF x==1 THEN FileWrite(f3,StrCat(StrFix(linenum," ",7),line)) ELSE FileWrite(f3,StrCat(StrFix(linenum," ",7),StrSub(line,x,-1))) ENDIF linenum=linenum+1 ENDWHILE FileClose(f1) FileClose(f3) Run("WinEdit",file3) RETURN "" #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :SPELLCHECKEDDATA ;{{{:SPELLCHECKEDDATA}}} #DEFINEFUNCTION Spellcheckeddata(batchu,file1) ;{{{#DEFINEFUNCTION Spellcheckeddata}}} Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. file4=AskFileName("Select spell checked file",FileNameLong(Environment("TEMP")),"All Files|*.*|WIL Files|*.wbt;*.mnu|Text Files|*.txt|","UF5*.tmp",1) ; Get spell checked file name. IF cancel THEN RETURN "" ; Cancel requested. f4=FileOpen(file4,"Read") f1=FileOpen(file1,"Read") file3=FileNameLong(FileCreateTemp("UF3")) f3=FileOpen(file3,"Write") linenum=1 file1short=1 line4=FileRead(f4) IF line4=="*EOF*" THEN GOTO FILE1SHORT IF batchu IF StrLower(file1)==StrTrim(StrLower(line4)) THEN file1short=0 ELSE wFileSave() IF StrLower(wGetFileName())==StrTrim(StrLower(line4)) THEN file1short=0 ENDIF IF file1short THEN GOTO FILE1SHORT WHILE @True line4=FileRead(f4) IF line4=="*EOF*" THEN BREAK IF StrTrim(line4)=="" THEN CONTINUE impnum=StrTrim(StrSub(line4,1,7)) line1=FileRead(f1) IF line1=="*EOF*" THEN file1short=1 THEN BREAK IF linenum<>impnum THEN GOSUB CATCHUP IF file1short THEN BREAK x=Spellcheckcomment(line1) IF x IF x==1 THEN FileWrite(f3,StrSub(line4,8,-1)) ELSE FileWrite(f3,StrCat(StrSub(line1,1,x-1),StrSub(line4,8,-1))) ENDIF linenum=linenum+1 ENDWHILE :FILE1SHORT ;{{{:FILE1SHORT}}} IF file1short IF batchu THEN Message("Spellcheck",StrCat("Spell-checked comments in file: '",file4,"'",@CrLf,"do not match comments in file: '",file1,"'")) ELSE Message("Spellcheck",StrCat("Spell-checked comments in file: '",file4,"'",@CrLf,"do not match comments in open file.")) ELSE GOSUB FINISH1 ENDIF FileClose(f1) FileClose(f3) FileClose(f4) IF file1short THEN RETURN "" ELSE RETURN file3 :CATCHUP ;{{{:CATCHUP}}} WHILE linenum<>impnum FileWrite(f3,line1) line1=FileRead(f1) IF line1=="*EOF*" THEN file1short=1 THEN BREAK linenum=linenum+1 ENDWHILE RETURN :FINISH1 ;{{{:FINISH1}}} WHILE @True line1=FileRead(f1) IF line1=="*EOF*" THEN BREAK FileWrite(f3,line1) ENDWHILE RETURN :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :SPLITFILE ;{{{:SPLITFILE}}} #DEFINEFUNCTION Splitfile(batchu,file1) ;{{{#DEFINEFUNCTION Splitfile}}} Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. split=1000 inc=10 WHILE @True spltnumformat='WWWDLGED,5.0' spltnumcaption='Split file' spltnumx=200 spltnumy=100 spltnumwidth=90 spltnumheight=50 spltnumnumcontrols=4 spltnum01='004,006,044,DEFAULT,STATICTEXT,DEFAULT,"Split every x lines: "' spltnum02='048,004,036,DEFAULT,EDITBOX,split,""' spltnum03='048,034,036,DEFAULT,PUSHBUTTON,DEFAULT,"&Split",1' spltnum04='004,034,036,DEFAULT,PUSHBUTTON,DEFAULT,"Cancel",0' spltnum=Dialog("spltnum") IF cancel || spltnum==0 THEN BREAK ; Cancel requested. IF !IsInt(split) THEN CONTINUE IF split<1 THEN CONTINUE BREAK ENDWHILE IF cancel || spltnum==0 THEN RETURN "" ; Cancel requested. f1=FileOpen(file1,"Read") last=0 list=FileNameLong(FileCreateTemp("UF6")) listh=FileOpen(list,"Write") WHILE @True file3=FileNameLong(FileCreateTemp("UF6")) f3=FileOpen(file3,"Write") FOR x=1 TO split line=FileRead(f1) IF line=="*EOF*" THEN last=1 THEN BREAK FileWrite(f3,line) NEXT FileClose(f3) FileWrite(listh,StrCat("byte=",StrFix(FileSize(file3)," ",12),"File=",file3)) IF last THEN BREAK ENDWHILE FileClose(f1) FileClose(listh) Message("File split",StrCat("For list of generated files names see file:",@CrLf,list)) RETURN "" :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- :JOINFILES ;{{{:JOINFILES}}} #DEFINEFUNCTION Joinfiles(batchu,file1) ;{{{#DEFINEFUNCTION Joinfiles}}} Intcontrol(73,2,0,0,0) ; Cancel and return. cancel=0 list=AskFileName("Join files: select additional file/2",FilePath(file1),"All Files|*.*","*.*",2) IF cancel THEN RETURN "" list=ItemInsert(file1,0,list,@Tab) f3=FileNameLong(FileCreateTemp("UF6")) f3h=FileOpen(f3,"Write") FOR x=1 TO ItemCount(list,@Tab) f1h=FileOpen(ItemExtract(x,list,@Tab),"Read") WHILE @True line=FileRead(f1h) IF line=="*EOF*" THEN BREAK FileWrite(f3h,line) ENDWHILE FileClose(f1h) NEXT FileClose(f3h) RETURN f3 :CANCEL ;{{{:CANCEL}}} cancel=1 RETURN #ENDFUNCTION RETURN ;--------------------------------------------------------------------------------------------------- ; ;--------------------------------------------------------------------------------------------------- :PRELOAD ; List of pre-loaded UDFs.;{{{:PRELOAD}}} #DEFINEFUNCTION fmFileMath( filea, fileb, fileout, optype) ;{{{#DEFINEFUNCTION fmFileMath}}} ;Only write lines in BOTH files Terminate(!fmVerifyFileObject(filea),"fmFileMath Error","Param1 not a FileObject") Terminate(!fmVerifyFileObject(fileb),"fmFileMath Error","Param2 not a FileObject") Terminate(!fmVerifyFileObject(fileout),"fmFileMath Error","Param3 not a FileObject") Terminate( (optype<1 || optype>5), "fmFileMath Error","param4 is not 1 2 3 4 or 5") ;Hack to optimize ADD(1) IF optype==1 FileCopy(filea[0],fileout[0],0) FileAppend(fileb[0], fileout[0]) fileout[1]=FileSize(fileout[0]) fileout[2]=filea[2]+fileb[2] ; Recordcount. fileout[3]=Max(filea[3],fileb[3]) ; Maxsize. fileout[5]=0 ; Sorted=false. fileout[6]=0 ; 'deduped=false. RETURN ENDIF ;Hack to optimize "OR" IF optype==3 ; OR. tempout=fmGetFileObject(FileNameLong(FileCreateTemp("~fm")),0) fmFileMath(filea,fileb,tempout,1) fmRemoveDups(tempout,fileout) FileDelete(tempout[0]) ;sorted and deduped status set by fmRemoveDups routine RETURN ENDIF SWITCH optype ; case 1 ; add ; ADD optimized above CASE 2 ; Subtract. tempa=fmGetFileObject(FileNameLong(FileCreateTemp("~fm")),0) tempb=fmGetFileObject(FileNameLong(FileCreateTemp("~fm")),0) fmSortFile(filea,tempa) fmSortFile(fileb,tempb) fileout[5]=1 ; Sorted. fileout[6]=0 ; Deduped. BREAK ; case 3 ; OR ; OR optimized above CASE 4 ; XOR. CASE 5 ; AND. tempa=fmGetFileObject(FileNameLong(FileCreateTemp("~fm")),0) tempb=fmGetFileObject(FileNameLong(FileCreateTemp("~fm")),0) fmRemoveDups(filea,tempa) fmRemoveDups(fileb,tempb) fileout[5]=1 ; Sorted. fileout[6]=1 ; Deduped. ENDSWITCH handlea=FileOpen(tempa[0],"READ") handleb=FileOpen(tempb[0],"READ") out=FileOpen(fileout[0],"WRITE") ;state machine 0 need both lines ; 1 compare 2 lines reccount=0 maxsize=0 state=optype WHILE 1 SWITCH state ; case 1 ;ADD ; ADD replaced by optimization above ; CASE 2 ; SUBTRACT. linea=StrTrim(FileRead(handlea)) lineb=StrTrim(FileRead(handleb)) :XSUBTRACT ;{{{:XSUBTRACT}}} IF linea=="*EOF*" state = 99 ; All done. CONTINUE ENDIF IF lineb=="*EOF*" FileWrite(out, linea) reccount=reccount+1 maxsize=Max(maxsize,StrLen(linea)) state=98 ; No more minus lines. CONTINUE ENDIF test=StrCmp(linea,lineb) IF test==0 ; Lines match. toast both of them. linea=StrTrim(FileRead(handlea)) lineb=StrTrim(FileRead(handleb)) ELSE IF test > 0 ; LineA > lineB Need new lineB. lineb=FileRead(handleb) ELSE ; LineA < lineB. FileWrite(out,linea) reccount=reccount+1 maxsize=Max(maxsize,StrLen(linea)) linea=FileRead(handlea) state=optype ENDIF ENDIF GOTO XSUBTRACT ; NB No structure levels being crossed. DON'T USE GOTOs!!!!!! BREAK ; case 3 ; OR ; OR replace by optimization aboce CASE 4 ; XOR. linea=StrTrim(FileRead(handlea)) lineb=StrTrim(FileRead(handleb)) :XXOR ;{{{:XXOR}}} IF linea=="*EOF*" IF lineb!="*EOF*" FileWrite(out,lineb) reccount=reccount+1 maxsize=Max(maxsize,StrLen(lineb)) state = 97 ; Dump rest of B. CONTINUE ENDIF state=99 CONTINUE ENDIF IF lineb=="*EOF*" FileWrite(out,linea) reccount=reccount+1 maxsize=Max(maxsize,StrLen(linea)) state=98 ; Dump rest of A. CONTINUE ENDIF test=StrCmp(linea,lineb) IF test==0 ; Lines match. toast both of them. linea=StrTrim(FileRead(handlea)) lineb=StrTrim(FileRead(handleb)) ELSE IF test > 0 ; LineA > lineB Need new lineB. FileWrite(out,lineb) reccount=reccount+1 maxsize=Max(maxsize,StrLen(lineb)) lineb=FileRead(handleb) ELSE ; LineA < lineB. FileWrite(out,linea) reccount=reccount+1 maxsize=Max(maxsize,StrLen(linea)) linea=FileRead(handlea) ENDIF ENDIF GOTO XXOR ; NB No structure levels being crossed. DON'T USE GOTOs!!!!!! BREAK CASE 5 ; AND. linea=StrTrim(FileRead(handlea)) lineb=StrTrim(FileRead(handleb)) :XAND ;{{{:XAND}}} IF linea=="*EOF*" state = 99 CONTINUE ENDIF IF lineb=="*EOF*" state = 99 CONTINUE ENDIF test=StrCmp(linea,lineb) IF test==0 ; Lines match. the only case where we write a line. FileWrite(out,linea) reccount=reccount+1 maxsize=Max(maxsize,StrLen(linea)) linea=StrTrim(FileRead(handlea)) lineb=StrTrim(FileRead(handleb)) ELSE IF test > 0 ; LineA > lineB Need new lineB. lineb=FileRead(handleb) ELSE ; LineA < lineB. linea=FileRead(handlea) ENDIF ENDIF GOTO XAND ; NB No structure levels being crossed. DON'T USE GOTOs!!!!!! BREAK CASE 97 ; Dump rest of B to the outfile. WHILE 1 lineb=FileRead(handleb) IF lineb=="*EOF*" THEN BREAK FileWrite(out,lineb) reccount=reccount+1 maxsize=Max(maxsize,StrLen(lineb)) ENDWHILE state=99 BREAK CASE 98 ; Dump rest of A to the outfile. WHILE 1 linea=FileRead(handlea) IF linea=="*EOF*" THEN BREAK FileWrite(out,linea) reccount=reccount+1 maxsize=Max(maxsize,StrLen(linea)) ENDWHILE state=99 BREAK ENDSWITCH IF state==99 THEN BREAK ENDWHILE FileClose(handlea) FileClose(handleb) FileClose(out) IF optype!=1 ; Not for adds. FileDelete(tempa[0]) FileDelete(tempb[0]) ENDIF fileout[1]=FileSize(fileout[0]) fileout[2]=reccount fileout[3]=maxsize RETURN #ENDFUNCTION ;--------------------------------------------------------------------------------------------------- #DEFINEFUNCTION fmGetDups( filein, fileout) ;{{{#DEFINEFUNCTION fmGetDups}}} Terminate(!fmVerifyFileObject(filein),"fmGetDups Error","Param1 not a FileObject") Terminate(!fmVerifyFileObject(fileout),"fmGetDups Error","Param2 not a FileObject") Terminate(StrIcmp(filein[0],fileout[0])==0,"RemoveDups Error","Input file may not equal Output file") tempout=fmGetFileObject(FileNameLong(FileCreateTemp("~fm")),0) fmSortFile(filein,tempout) handle=FileOpen(tempout[0],"READ") outhandle=FileOpen(fileout[0],"WRITE") lastrec="dfrt456tgsdr436yter57857456345tefg577878765gdfgsdf345346rthdrg4352efhtyiu67uy4t" reccount=0 maxsize=0 WHILE 1 line=FileRead(handle) IF line=="*EOF*" THEN BREAK IF line == lastrec reccount=reccount+1 maxsize=Max(maxsize,StrLen(line)) FileWrite(outhandle,line) ELSE lastrec=line ENDIF ENDWHILE FileClose(handle) FileClose(outhandle) FileDelete(tempout[0]) fileout[1]=FileSize(fileout[0]) fileout[2]=reccount fileout[3]=maxsize fileout[5]=1 ; Tis sorted. fileout[6]=0 ; Probably not dup free. RETURN #ENDFUNCTION ;--------------------------------------------------------------------------------------------------- #DEFINEFUNCTION fmGetFileObject( filenamein ,flag) ; Flag0=normal 1=newfile.;{{{#DEFINEFUNCTION fmGetFileObject}}} ;THis functions returns an array object of 7 elements ;0=Filename 1=FileSize 2=Record-count 3=max-record-size 4=FileObjectCode 5=sortedflag 6=dedupedflag fileobject=ArrDimension(7) fileobject[0]=FileFullName(filenamein) fileobject[1]=FileSize(filenamein) IF flag==1 Terminate(!FileExist(filenamein),"File not found",FileFullName(filenamein)) handle=FileOpen(filenamein,"READ") reccount=0 maxsize=0 WHILE 1 line=FileRead(handle) IF line=="*EOF*" THEN BREAK reccount=reccount+1 maxsize=Max(maxsize,StrLen(line)) ENDWHILE FileClose(handle) fileobject[2]=reccount fileobject[3]=maxsize ELSE fileobject[2]=0 fileobject[3]=0 ENDIF fileobject[4]=1234567 fileobject[5]=0 ; Sorted=false. fileobject[6]=0 ; 'deduped=false. RETURN (fileobject) #ENDFUNCTION ;--------------------------------------------------------------------------------------------------- #DEFINEFUNCTION fmRemoveDups( filein, fileout) ;{{{#DEFINEFUNCTION fmRemoveDups}}} Terminate(!fmVerifyFileObject(filein),"RemoveDups Error","Param1 not a FileObject") Terminate(!fmVerifyFileObject(fileout),"RemoveDups Error","Param2 not a FileObject") Terminate(StrIcmp(filein[0],fileout[0])==0,"RemoveDups Error","Input file may not equal Output file") IF filein[6]==1 ; Pre=deduped. FileCopy(filein[0],fileout[0],0) fileout[1]=FileSize(fileout[0]) fileout[2]=filein[2] fileout[3]=filein[3] fileout[5]=filein[5] fileout[6]=filein[6] ELSE tempout=fmGetFileObject(FileNameLong(FileCreateTemp("~fm")),0) fmSortFile(filein,tempout) handle=FileOpen(tempout[0],"READ") outhandle=FileOpen(fileout[0],"WRITE") lastrec="dfrt456tgsdr436yter57857456345tefg577878765gdfgsdf345346rthdrg4352efhtyiu67uy4t" reccount=0 maxsize=0 WHILE 1 line=FileRead(handle) IF line=="*EOF*" THEN BREAK IF line != lastrec lastrec=line reccount=reccount+1 maxsize=Max(maxsize,StrLen(line)) FileWrite(outhandle,line) ENDIF ENDWHILE FileClose(handle) FileClose(outhandle) FileDelete(tempout[0]) fileout[1]=FileSize(fileout[0]) fileout[2]=reccount fileout[3]=maxsize fileout[5]=1 ; Sorted=true. fileout[6]=1 ; 'deduped=true. ENDIF RETURN #ENDFUNCTION ;--------------------------------------------------------------------------------------------------- #DEFINEFUNCTION fmSortFile( filein, fileout) ;{{{#DEFINEFUNCTION fmSortFile}}} Terminate(!fmVerifyFileObject(filein),"SortFile Error","Param1 not a FileObject") Terminate(!fmVerifyFileObject(fileout),"SortFile Error","Param2 not a FileObject") IF filein[5]==1 ; Is it already sorted? FileCopy(filein[0],fileout[0],0) ELSE reccount=filein[2] maxsize=filein[3] bb=BinaryAlloc(reccount*maxsize) handle=FileOpen(filein[0],"READ") ptr=0 WHILE 1 line=FileRead(handle) IF line=="*EOF*" THEN BREAK BinaryPokeStr(bb,ptr,line) ptr=ptr+maxsize ENDWHILE ptr=ptr-maxsize FileClose(handle) BinaryEodSet(bb,reccount*maxsize) IF ptr THEN BinarySort(bb, maxsize, 0, maxsize, 0 ) handle=FileOpen(fileout[0],"WRITE") IF ptr FOR x=0 TO ptr BY maxsize FileWrite(handle,BinaryPeekStr(bb,x,maxsize)) NEXT ENDIF FileClose(handle) ENDIF fileout[1]=FileSize(fileout[0]) fileout[2]=filein[2] fileout[3]=filein[3] fileout[5]=1 ; Sorted=TRUE. fileout[6]=filein[6] ; Preserve deduped status. RETURN #ENDFUNCTION ;--------------------------------------------------------------------------------------------------- #DEFINEFUNCTION fmSortFileReverse( filein, fileout) ;{{{#DEFINEFUNCTION fmSortFileReverse}}} Terminate(!fmVerifyFileObject(filein),"SortFile Error","Param1 not a FileObject") Terminate(!fmVerifyFileObject(fileout),"SortFile Error","Param2 not a FileObject") IF filein[5]==1 ; Is it already sorted? FileCopy(filein[0],fileout[0],0) ELSE reccount=filein[2] maxsize=filein[3] bb=BinaryAlloc(reccount*maxsize) handle=FileOpen(filein[0],"READ") ptr=0 WHILE 1 line=FileRead(handle) IF line=="*EOF*" THEN BREAK BinaryPokeStr(bb,ptr,line) ptr=ptr+maxsize ENDWHILE ptr=ptr-maxsize FileClose(handle) BinaryEodSet(bb,reccount*maxsize) IF ptr THEN BinarySort(bb, maxsize, 0, maxsize,@Descending|@String) handle=FileOpen(fileout[0],"WRITE") IF ptr FOR x=0 TO ptr BY maxsize FileWrite(handle,BinaryPeekStr(bb,x,maxsize)) NEXT ENDIF FileClose(handle) ENDIF fileout[1]=FileSize(fileout[0]) fileout[2]=filein[2] fileout[3]=filein[3] fileout[5]=1 ; Sorted=TRUE. fileout[6]=filein[6] ; Preserve deduped status. RETURN #ENDFUNCTION ;--------------------------------------------------------------------------------------------------- #DEFINEFUNCTION fmVerifyFileObject(obj) ;{{{#DEFINEFUNCTION fmVerifyFileObject}}} ; check to make sure passed parameter is afile object IF VarType(obj)==256 IF obj[4]==1234567 RETURN(1) ENDIF ENDIF RETURN(0) #ENDFUNCTION ;--------------------------------------------------------------------------------------------------- #DEFINEFUNCTION Fmcolumnsort(filein,fileout,file3) ;{{{#DEFINEFUNCTION Fmcolumnsort}}} Terminate(!fmVerifyFileObject(filein),"SortFile Error","Param1 not a FileObject") Terminate(!fmVerifyFileObject(fileout),"SortFile Error","Param2 not a FileObject") reccount=filein[2] maxsize=filein[3] sc=1 ec=maxsize Intcontrol(72,2,0,0,0) ; Cancel and return. cancel=0 ; Reset. WHILE @True shiftcformat=`WWWDLGED,5.0` shiftccaption=`Column Sort ` shiftcx=300 shiftcy=50 shiftcwidth=108 shiftcheight=78 shiftcnumcontrols=9 shiftc01=`1,12,30,DEFAULT,STATICTEXT,DEFAULT,"Start Column"` shiftc02=`34,10,15,DEFAULT,EDITBOX,sc,""` shiftc03=`55,10,15,DEFAULT,EDITBOX,ec,""` shiftc04=`072,12,36,DEFAULT,STATICTEXT,DEFAULT,"End Column"` shiftc05=`12,30,35,DEFAULT,RADIOBUTTON,asc,"&Ascending",1` shiftc06=`50,30,45,DEFAULT,RADIOBUTTON,asc,"&Descending",2` shiftc07=`02,44,106,DEFAULT,STATICTEXT,DEFAULT,"Note: end or maximum column is %maxsize%"` shiftc08=`11,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Sort",1` shiftc09=`58,58,36,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",2` shcbp=Dialog("Shiftc") IF cancel || shcbp==2 THEN BREAK ; Cancel requested. IF !IsNumber(sc) || !IsNumber(ec) THEN CONTINUE IF sc<1 || sc>maxsize || ec<1 || ec>maxsize || ec =0 xxresult3="contents are identical" xxresult4=StrCat("same size but different - ",file1," is newer") xxresult2=StrCat("same size but different - ",file2," is newer") xxresult5=StrCat("are different - ",file1," is newer") xxresult1=StrCat("are different - ",file2," is newer") xxresult6=StrCat(file2," missing - only ",file1," exists") xxresult0=StrCat(file1," missing - only ",file2," exists") xxresult7="Neither file exists" xxresulta="File compare result:" xxresultb=StrCat(@CrLf,file1,@CrLf,file2,@CrLf," ",@CrLf,xxresult%xxcx%) Message(xxresulta,xxresultb) ; Report result of compare. xxcx=xxcx-3 ; Reset to original return code. IF xxcx == 1 | xxcx == -1 | xxcx == 2 | xxcx == -2 ; Difference. xxq=AskYesNo("Compare","View differences ?") ; Give user option to view difference. IF xxq==@Yes THEN Run("C:\SuppTools\windiff.exe",StrCat(FileNameShort(file1)," ",FileNameShort(file2))) ENDIF ELSE IF xxcx==-2 THEN Run("C:\SuppTools\windiff.exe",StrCat("/D ",FileNameShort(FilePath(file1))," ",FileNameShort(FilePath(file2)))) ELSE Run("C:\SuppTools\windiff.exe",StrCat(FileNameShort(FilePath(file1))," ",FileNameShort(FilePath(file2)))) ENDIF #ENDFUNCTION ;--------------------------------------------------------------------------------------------------- #DEFINEFUNCTION Spellcheckcomment(line) ;{{{#DEFINEFUNCTION Spellcheckcomment}}} IF StrTrim(line)=="" THEN RETURN 0 ; Quick blank line check. IF StrSub(StrTrim(line),1,1)==";" THEN RETURN 1 ; Quick """check for comment-only line. x=1 ; Start of scan. :COMMENT1 ;{{{:COMMENT1}}} x=StrScan(line,";""'`",x,@Fwdscan) ; Find semi-colon, 'double, single or back quote. IF !x THEN RETURN 0 ; No comment in line. IF StrSub(line,x,1)==";" THEN RETURN x ; Left-most comment found. oq=StrSub(line,x,1) ; Save orig quote. :COMMENT2 x=StrScan(line,oq,x+1,@Fwdscan) ; Find complimentary quote. IF !x THEN RETURN 0 ; Line can't have a comment. IF StrSub(line,x+1,1)==oq THEN x=x+2 THEN GOTO COMMENT2 ; It's a doubledouble quote. ELSE x=x+1 ; Position for next literal scan. ELSE GOTO COMMENT1 ; Start again. #ENDFUNCTION RETURN ;---------------------------------------------------------------------------------------------------
Article ID: W15776
File Created: 2003:05:13:11:30:02
Last Updated: 2003:05:13:11:30:02