;WINEDIT.MNU file. ; ;Modifications courtesy of Don Lekei, Richard Merit, Morrie Wilson ; and many many others. Thank you very much. ; ; Some functions, like version control and alternate grep commands, ; are presented here but commented out. If you have the corresponding ; utility, just delete the semicolons from column 1 and the function ; will be enabled. ; ; ; ; AutoExec Section is on top here. ; TAB=@TAB CR=@CRLF EOL=@CR Home=DirHome() IntControl(29,@tab,0,0,0) ;Standardize on tabs as delimiters for FileItemize, etc Key Word Help \ +{F1} ; Load help topic for word at cursor call(strcat(DirHome(),"System\wwwedit.dll"),"KEYWORDHELP") Load Help File ; Load a help file (no keyword lookup) TheFile=strcat(DirHome(),"System\WEHELP.INI") Keys=IniItemizePvt("HelpAll",TheFile) KeyMax=ItemCount(Keys,@TAB) KeyIndex=0 KeyValues="" :ieLoop if KeyIndex==KeyMax then goto looped KeyIndex=KeyIndex+1 ThisKey=ItemExtract(KeyIndex,Keys,@TAB) if (stricmp(ThisKey,"DEFAULT")==0) then goto ieloop ThisValue=IniReadPvt("HelpAll",ThisKey,"???",TheFile) KeyValues=strcat(KeyValues,ThisValue,"|") goto ieLoop :looped a=ItemSelect("Select Help File",strlower(KeyValues),"|") if a=="" then goto DONE b = FileLocate(strcat(DirHome(),"HELP\%a%")) if b=="" then b=FileLocate(a) if b=="" then Message("Helpfile %a% not found","Edit %TheFile%%CR%[HelpAll] section to%CR%point to help file location%CR%or put helpfile on DOS path.") else WinHelp(b,"CONTENTS","") :DONE Drop(TheFile,Keys,KeyMax,KeyIndex,KeyValues,ThisKey,ThisValue,a,b) ; ; HTML ;Insert HTML tags into this document Anchor - Image wImgTag() Anchor - Text ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) ; restore the clipboard Applet ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsLine('') wInsLine('\^') wInsLine('') wNewLine() wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) ; restore the clipboard Colors Black wInsString('color="#000000"') Silver wInsString('color="#C0C0C0"') Gray wInsString('color="#808080"') White wInsString('color="#FFFFFF"') Maroon wInsString('color="#800000"') Red wInsString('color="#FF0000"') Purple wInsString('color="#800080"') Fuchsia wInsString('color="#FF00FF"') Green wInsString('color="#008000"') Lime wInsString('color="#00FF00"') Olive wInsString('color="#808000"') Yellow wInsString('color="#FFFF00"') Blue wInsString('color="#0000FF"') Navy wInsString('color="#000080"') Teal wInsString('color="#008080"') Aqua wInsString('color="#00FFFF"') Comment ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Font Template ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Font Size Font 1 ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Font 2 ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Font 3 ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Font 4 ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Font 5 ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Font 6 ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Font 7 ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Big ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Small ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Superscript ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Subscript ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Formatting Horizontal Rule wInsLine('
') Bold \^B ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Italic ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Underline ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Emphasis ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Strong Emphasis ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Headings

Heading ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('

\^

') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s)

Heading ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('

\^

') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s)

Heading ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('

\^

') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s)

Heading ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('

\^

') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s)
Heading ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('
\^
') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s)
Heading ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('
\^
') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Lists Unordered wInsLine('') Ordered wInsLine('
    ') wInsLine('
  1. ?') wHome() wInsLine('
  2. ?') wHome() wInsLine('
  3. ?') wHome() wInsLine('
') Definition ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsLine('
') wInsLine('
\^
?') wHome() wInsLine('
?
?') wHome() wInsLine('
?
?') wHome() wInsLine('
') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Tables Table Template ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsLine('') wInsLine('') wInsLine(' ') wHome() wInsLine(' ') wHome() wInsLine('') wInsLine(' ') wHome() wInsLine(' ') wHome() wInsLine('
\^?
? ?
') wNewLine() wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) ; restore the clipboard Row ; Insert this tag template into document ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Heading ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) Data ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsString('\^') wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) _View in Browser ; View the current document in a browser window wViewHtml() Blank HTML Document ; Insert a basic html template into the document q = AskYesNo("New HTML Document","Open a new document?") if q == @YES wFileNew() else wEnd() wNewLine() wHome() endif ErrorMode(@OFF) s=ClipGet() ErrorMode(@ON) ClipPut("") ; clear the clipboard wCut() wInsLine('') wNewLine() wInsLine('') wNewLine() wInsLine('') wNewLine() wInsLine('\^') wNewLine() wInsLine('') wInsLine('') wInsLine('') wInsLine('') wNewLine() wInsLine('') wNewLine() wInsLine('') wNewLine() wNewLine() wInsLine('') wNewLine() wInsLine('') wNewLine() wFind("\^",@FALSE,@TRUE,@FALSE,@FALSE) wPaste() ClipPut(s) ; restore the clipboard Java Run Java Applet ; Run this compiled java class in WinEdit Explorer filename = wGetFileName() path = FilePath(filename) basename = FileRoot(filename) olddir = DirGet() javaname = strcat(path,"%basename%.class") if (FileExist(javaname)) DirChange(path) ; see if there is already an html file in this directory ; and offer to run that htmllist = FileItemize("*.html") if (htmllist != "") ifile = AskItemList("Choose an html file", htmllist, @TAB, @unsorted, @single) if (ifile != "") htmlname = strcat(FileRoot(ifile),".html") else ; make an html wrapper for the class to run in htmlname = strcat(path,"%basename%.html") h = FileOpen(htmlname, "WRITE") FileWrite(h, '') FileWrite(h, '') FileWrite(h, '') FileWrite(h, '') FileWrite(h, ' ') FileWrite(h, '') FileWrite(h, ' %basename% Applet') FileWrite(h, '') FileWrite(h, ' ') FileWrite(h, '') FileWrite(h, '

%basename% Applet

') FileWrite(h, '') FileWrite(h, '
') FileWrite(h, '') FileWrite(h, '') FileWrite(h, '') FileWrite(h, '
') FileWrite(h, '') FileWrite(h, ' ') FileWrite(h, '') FileWrite(h, '') FileClose(h) endif endif Run("appletviewer","%htmlname%") DirChange(olddir) wViewOutput() else Message("Run Java Applet","Couldn't find %javaname%. Is it compiled?") endif Run Java Application (graphical) ; Run this java class in the java environment filename = wGetFileName() path = FilePath(filename) basename = FileRoot(filename) olddir = DirGet() DirChange(path) Run("java", "%basename%") DirChange(olddir) drop(filename,path,basename,olddir) Run Java Application (console) ; Run this java class from a command window filename = wGetFileName() path = FilePath(filename) basename = FileRoot(filename) olddir = DirGet() DirChange(path) if (WinVersion(4) == 4) strRun = "cmd.exe" else strRun = "command.com" endif Run("%strRun%", "/k java %basename%") DirChange(olddir) drop(filename,path,basename,olddir) Run Java App (prompt for parameters) ; Run this java class in the java environment filename = wGetFileName() path = FilePath(filename) basename = FileRoot(filename) olddir = DirGet() parameters = AskLine("Command line parameters","Enter any command line parameters", "") DirChange(path) Run("java", "%basename% %parameters%") DirChange(olddir) drop(filename,path,basename,olddir) Perl Insert Conditionals if filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. a = wGetColNo() wInsLine("if ( xx == yy ) {") wInsLine(" ;;") wGoToCol( a ) wInsLine("};") wNewLine() endif drop(a,filext) unless filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. a = wGetColNo() wInsLine("unless ( xx == yy ) {") wInsLine(" ;;") wGoToCol( a ) wInsLine("};") endif drop(a,filext) if-else filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. a = wGetColNo() wInsLine("if ( xx == yy ) {") wInsLine(" ;;") wGoToCol( a ) wInsLine("}") wInsLine("else {") wInsLine(" ;;") wGoToCol( a ) wInsLine("};") endif drop(a,filext) unless-else filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. a = wGetColNo() wInsLine("unless ( xx == yy ) {") wInsLine(" ;;") wGoToCol( a ) wInsLine("}") wInsLine("else {") wInsLine(" ;;") wGoToCol( a ) wInsLine("};") endif drop(a,filext) ; ;===================================================================== Insert Loops for filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. a = wGetColNo() wInsLine("for ( $i=1; i <= yy; $i++) {") wInsLine(" ;;") wGoToCol( a ) wInsLine("};") endif drop(a,filext) foreach filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. a = wGetColNo() wInsLine("foreach $var (list) {") wInsLine(" ;;") wGoToCol( a ) wInsLine("};") endif drop(a,filext) do-while filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. a = wGetColNo() wInsLine("do {") wInsLine(" ;;") wGoToCol( a ) wInsLine("} while (xx == yy);") endif drop(a,filext) while filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. a = wGetColNo() wInsLine("while ( xx==yy ) {") wInsLine(" ;;") wGoToCol( a ) wInsLine("};") endif drop(a,filext) ; ;===================================================================== Insert Misc cond-op (?:) filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. wInsString("test_expr ? if_true_expr : if_false_expr;") endif drop(filext) list-variable (@) filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. wInsString("my(@list) = ( str1, str2 );") endif drop(filext) hash-variable (%) filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. a = wGetColNo() wInsLine("my(%%hash) =") wInsLine("{") wGoToCol( a+3 ) wInsLine( "key1 => val1") wInsLine( "key2 => val2") wGoToCol( a ) wInsLine("};") endif drop(a,filext) Subroutine filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. a = wGetColNo() wInsLine("sub funcName") wInsLine("{") wGoToCol( a+3 ) wInsLine("# sub BODY") wGoToCol( a ) wInsLine("} #end sub funcName") endif drop(a,filext) Subroutine w/prototype filext = strupper(FileExtension(wGetFileName())) if filext=="PL" || filext=="PM" ; Check to be sure. a = wGetColNo() wInsLine("sub funcName($$)") wInsLine("{") wGoToCol( a+3 ) wInsLine("# sub BODY") wGoToCol( a ) wInsLine("} #end sub funcName") endif drop(a,filext) Insert Block If C,WIL filext = strupper(FileExtension(wGetFileName())) if filext!="WBT" && filext!="WIL" && filext!="MNU" && filext!="MNW" && filext!="WEB" ; Assume C b = wGetLineNo() c = wGetColNo() wInsString("if( ") a = wGetColNo() wNewLine() c = wGetColNo() wInsString("{") wNewLine() wInsString(" ;") wNewLine() wGoToCol( c ) wInsString("}") wNewLine() wEnd() wInsString(";") wHome() wStartSel() wEnd() wEndSel() wDelete() wGoToLine( b ) wGoToCol( a ) wInsString("xx == yy )") wLeft() wLeft() b = wGetColNo() wGoToCol( a ) wStartSel() wGoToCol( b ) wEndSel() else wInsString("if xx == yy") wNewLine() wNewLine() wInsString("endif") wNewLine() wUpLine() wUpLine() endif drop(s,filext) If-Else C,WIL wNewLine() wUpLine() ; First determine if it is C or WIL ;debug(1) filext = strupper(FileExtension(wGetFileName())) if filext=="WBT" || filext=="WIL" || filext=="MNU" || filext=="WEB" ; Its WIL wInsString("if xx == yy") wNewLine() wNewLine() wInsString("else") wNewLine() wNewLine() wInsString("endif") wNewLine() wUpLine() wUpLine() wUpLine() wUpLine() else ;assume C b = wGetLineNo() c = wGetColNo() wInsString("if( ") a = wGetColNo() wNewLine() c = wGetColNo() wInsString("{") wNewLine() wInsString(" ;") wNewLine() wGoToCol( c ) wInsString("}") wNewLine() wInsString("else") wNewLine() wInsString("{") wNewLine() wInsString(" ;") wNewLine() wGoToCol( c ) wInsString("}") wNewLine() wEnd() wInsString(";") wHome() wStartSel() wEnd() wEndSel() wDelete() wGoToLine( b ) wGoToCol( a ) wInsString("xx == yy )") wLeft() wLeft() b = wGetColNo() wGoToCol( a ) wStartSel() wGoToCol( b ) wEndSel() endif drop(s,filext) Switch C,WIL filext = strupper(FileExtension(wGetFileName())) if filext=="WBT" || filext=="WIL" || filext=="MNU" || filext=="WEB" ; Its WIL wNewLine() wUpLine() wNewLine() wUpLine() wInsString("switch switchvar") wNewLine() wInsString(" case 1") wNewLine() wInsString(" break") wNewLine() wNewLine() wLeft() wLeft() wLeft() wInsString("case 2") wNewLine() wInsString(" break") wNewLine() wNewLine() wLeft() wLeft() wLeft() wInsString("case 3") wNewLine() wInsString(" break") wNewLine() wNewLine() wLeft() wLeft() wLeft() wLeft() wLeft() wLeft() wInsString("endswitch") wNewLine() wUpLine() wUpLine() wUpLine() wUpLine() wUpLine() wUpLine() wUpLine() wUpLine() wUpLine() else ;assume C b = wGetLineNo() c = wGetColNo() wInsString("switch( ") a = wGetColNo() wNewLine() wGoToCol( c ) wInsString("{ ") wNewLine() wGoToCol( c+2 ) wInsString("case 1:") wNewLine() wInsString(" ;") wNewLine() wInsString("break;") wNewLine() wNewLine() wGoToCol( c+2 ) wInsString("case 2:") wNewLine() wInsString(" ;") wNewLine() wInsString("break;") wNewLine() wNewLine() wGoToCol( c+2 ) wInsString("case 3:") wNewLine() wInsString(" ;") wNewLine() wInsString("break;") wNewLine() wGoToCol( c ) wInsString("}") wNewLine() wEnd() wInsString(";") wHome() wStartSel() wEnd() wEndSel() wDelete() wGoToCol( a ) wGoToLine( b ) wInsString("switchVar )") wLeft() wLeft() b = wGetColNo() wGoToCol( a ) wStartSel() wGoToCol( b ) wEndSel() endif drop(s,filext) _For C,WIL filext = strupper(FileExtension(wGetFileName())) if filext!="WBT" && filext!="WIL" && filext!="MNU" && filext!="MNW" &&filext!="WEB" ; Assume C b = wGetLineNo() c = wGetColNo() wInsString("for( ") a = wGetColNo() wNewLine() wGoToCol( c ) wInsString("{") wNewLine() wInsString(" ;") wNewLine() wGoToCol( c ) wInsString("}") wNewLine() wEnd() wInsString(";") wHome() wStartSel() wEnd() wEndSel() wDelete() wGoToCol( a ) wGoToLine( b ) wInsString("aa; bb==cc ;dd )") wLeft() wLeft() b = wGetColNo() wGoToCol( a ) wStartSel() wGoToCol( b ) wEndSel() else wInsString("for xx = 1 to 10") wNewLine() wNewLine() wInsString("next") wNewLine() wUpLine() wUpLine() endif drop(s,filext) While C,WIL filext = strupper(FileExtension(wGetFileName())) if filext=="WBT" || filext=="WIL" || filext=="MNU" || filext=="WEB" ; Its WIL wNewLine() wUpLine() wInsString("while xx == yy") wNewLine() wNewLine() wInsString("endwhile") wNewLine() wUpLine() wUpLine() else ;assume C b = wGetLineNo() c = wGetColNo() wInsString("while( ") a = wGetColNo() wNewLine() wGoToCol( c ) wInsString("{") wNewLine() wInsString(" ;") wNewLine() wGoToCol( c ) wInsString("}") wNewLine() wEnd() wInsString(";") wHome() wStartSel() wEnd() wEndSel() wDelete() wGoToCol( a ) wGoToLine( b ) wInsString("xx == yy )") wLeft() wLeft() b = wGetColNo() wGoToCol( a ) wStartSel() wGoToCol( b ) wEndSel() drop(s,filext) endif drop(s,filext) Do-While C,WIL filext = strupper(FileExtension(wGetFileName())) if filext!="WBT" && filext!="WIL" && filext!="MNU" && filext!="WEB" && filext!="MNW" ; Assume C b = wGetLineNo() c = wGetColNo() wInsString("do") wNewLine() wGoToCol( c ) wInsString("{") wNewLine() wInsString(" ;") wNewLine() wGoToCol( c ) wInsString("} while( ") a = wGetColNo() b = wGetLineNo() wNewLine() wEnd() wInsString(";") wHome() wStartSel() wEnd() wEndSel() wDelete() wGoToCol( a ) wGoToLine( b ) wInsString("xx == yy )") wLeft() wLeft() b = wGetColNo() wGoToCol( a ) wStartSel() wGoToCol( b ) wEndSel() else wNewLine() wUpLine() wInsString("while @TRUE") wNewLine() wNewLine() wInsString(" if xx==yy then break") wNewLine() wInsString("endwhile") wNewLine() wUpLine() wUpLine() wUpLine() endif drop(s,filext) _ifdef-else C,ASM filext = strupper(FileExtension(wGetFileName())) if filext=="C" || filext=="CPP" || filext=="H" ; Assume C b = wGetLineNo() c = wGetColNo() wInsString("#ifdef ") a = wGetColNo() wNewLine() wNewLine() wGoToCol( c ) wInsString("#else") wNewLine() wNewLine() wGoToCol( c ) wInsString("#endif") wNewLine() wInsString(";") wStartSel() wHome() wEndSel() wDelete() wNewLine() wGoToCol( a ) wGoToLine( b ) wInsString("CONDITION") drop(s,filext) b = wGetColNo() wGoToCol( a ) wStartSel() wGoToCol( b ) wEndSel() endif filext = strupper(FileExtension(wGetFileName())) if filext=="ASM" wNewLine() wUpLine() b = wGetLineNo() c = wGetColNo() wInsString("IFDEF ") a = wGetColNo() wNewLine() wNewLine() wGoToCol( c ) wInsString("ELSE") wNewLine() wNewLine() wGoToCol( c ) wInsString("ENDIF") wNewLine() wInsString(";") wStartSel() wHome() wEndSel() wDelete() wNewLine() wGoToCol( a ) wGoToLine( b ) wInsString("CONDITION") b = wGetColNo() wGoToCol( a ) wStartSel() wGoToCol( b ) wEndSel() endif drop(s,filext) _Comment block \ +^B ; Insert a comment block into the document filext = strupper(FileExtension(wGetFileName())) if filext=="WBT" || filext=="WIL" || filext=="MNU" || filext=="WEB" || filext=="MNW" then cmt=";" ; Its WIL else cmt="//" s="" ;if wGetSelState() then s=wGetWord() clipput ("%cmt%***************************************************************************%CR%") clipappend("%cmt%** %s%%CR%") clipappend("%cmt%** %CR%") clipappend("%cmt%** %CR%") clipappend ("%cmt%***************************************************************************%CR%") wgotocol(1) ;insert above current line wstartsel() wendsel() wnewline() wgotocol(1) ;insert above current line wpaste() wdownline() wdownline() wend() drop(s,filext,cmt) ; ;Builds a DETAILED comment block from the label under the cursor. ; Comment SUPER block \ ^!B ; Insert a detailed comment block into the document filext = strupper(FileExtension(wGetFileName())) if filext=="WBT" || filext=="WIL" || filext=="MNU" || filext=="WEB" || filext=="MNW" then cmt=";" ; Its WIL else cmt="//" s="" ;if wGetSelState() then s=wGetWord() clipput ("%cmt%***************************************************************************%CR%") clipappend("%cmt%** %s%%CR%") clipappend("%cmt%** %CR%") clipappend("%cmt%** %CR%") clipappend("%cmt%** Inputs: %CR%") clipappend("%cmt%** Outputs: %CR%") clipappend("%cmt%** Preserves: %CR%") clipappend("%cmt%** Corrupts: %CR%") clipappend ("%cmt%***************************************************************************%CR%") wgotocol(1) ;insert above current line wstartsel() wendsel() wnewline() wgotocol(1) ;insert above current line wpaste() wdownline() wdownline() wend() drop(s,filext,cmt) ; ;Merge File header comment file from disk ; ;Header Block \ ^!H ; wgotoline(1) ; wGotoCol(1) ; wFileMerge("header") ; ;Shells external process to produce fancy printout of a file ; ;Hardcopy \ ^H ; n=wGetfilename() ; cmd="-o=10 -l,l %n% > lpt1" ; AskLine("Hardcopy","Enter hardcopy command:",cmd) ; wRunCommand("DOSPRMPT.PIF /c hcopy %cmd%",@FALSE,@FALSE) ; drop (n,cmd) Convert Line Endings DOS to Unix ; Replace CR/LF line endings with LF only fn = wGetFileName() fs=Filesize(fn) errormode(@off) LastError() bb=BinaryAlloc(fs) errormode(@Cancel) err=LastError() if err!=0 message("File Too Large Err %err%","Try a smaller file") wFileOpen(fn) exit endif BinaryRead(bb,fn) oldname=strcat(FilePath(fn),FileRoot(fn),".BAK") wWinClose () Mac=BinaryStrCnt(bb,0,fs-1,@LF) If Mac==0 message ("No Linefeeds","This file can't be safely stripped") wFileOpen(fn) binaryfree(bb) exit endif FileMove(fn,oldname,0) ; Make backup if binarypeek(bb,0)==13 then binarypokestr(bb,0," ") q=0 while 1 q=BinaryIndexEx(bb,q,@CR,@fwdscan,0) if q== -1 then break BinaryPokeStr(bb,q," ") endwhile BinaryWrite(bb,fn) BinaryFree(bb) wFileOpen(fn) Unix to DOS ; Replace LF line endings with CR/LF ;if isdefined(dest) ; if dest<>0 then binaryfree(dest) ;endif ;if isdefined(source) ; if source<>0 then binaryfree(source) ;endif fn = wGetFileName() fs=Filesize(fn)+1 errormode(@off) LastError() source=BinaryAlloc(fs) errormode(@cancel) err=LastError() if err!=0 message("File Too Large Err# %err%","Try a smaller file") wFileOpen(fn) exit endif BinaryRead(source,fn) BinaryPoke(source,fs-1,10) DestSize= fs+BinaryStrCnt(source,0,fs-1,@LF)-1 dest=BinaryAlloc(DestSize+1) oldname=strcat(filepath(fn),FileRoot(fn),".BAK") wWinClose () Smark=0 Dmark=0 while Smark3 then bug=strcat(strsub(bug,1,math-3),',',strsub(bug,math-2,3)) sysinfo=strcat(sysinfo,CR,bug," KB Free Memory",CR) sysinfo=strcat(sysinfo,WinResources(2),"%% System Resources Free (",WinResources(3),"%% GDI, ",WinResources(4),"%% User)",CR) break case wcx bug=WinResources(11)/1024 ; Get Physical memory avail sysinfo=strcat(sysinfo,CR,bug," KB Physical Memory",CR) bug=(WinResources(14)/1024)+bug ; Get Virtual memory + Physical avail sysinfo=strcat(sysinfo,bug," KB Total Memory",CR) end switch sysinfo=strcat(sysinfo,"Console ",DosVersion(1),'.',DosVersion(0)," using ",environment("COMSPEC"),@CRLF) disks=DiskScan(1) disks=StrReplace(disks,@tab," ") if disks!="" then sysinfo=strcat(sysinfo,"Floppies ",disks,@CRLF) disks=DiskScan(2) disks=StrReplace(disks,@tab," ") if disks!="" then sysinfo=strcat(sysinfo,"Hard Disks ",disks,@CRLF) disks=DiskScan(4) disks=StrReplace(disks,@tab," ") if disks!="" then sysinfo=strcat(sysinfo,"Network Disks ",disks,@CRLF) sysinfo=strcat(sysinfo,"Windows Directory ",DirWindows(0),@CRLF) sysinfo=strcat(sysinfo,"System Directory ",DirWindows(1),@CRLF) sysinfo=strcat(sysinfo,@CRLF,"WIL Interpreter Ver ",VersionDll()) ver=Version() Message("%Param2% %ver% SysInfo",Sysinfo) Exit _Interactive Execution ; Enter and run WIL commands directly if !IsDefined(uyit65) then uyit65="Message( , )" :NEXT uyit65=AskLine("Interactive Execution","Enter Command",uyit65) execute %uyit65% goto NEXT Run this WIL Script File ; Runs the current file as a WIL Script if wGetModified()==@TRUE then wFileSave() TheFile = WGetFileName() Call(TheFile,"") _How do I?... ; Learn about using scripts Use Menu Scripts ; Menu file reference helpfile = strcat(home,"System\Windows Interface Language.hlp") WinHelp(helpFile, "PartialKey", "Menu Files") Write WIL Scripts ; WIL scripting language reference helpfile = strcat(home,"System\Windows Interface Language.hlp") WinHelp(helpFile, "PartialKey", "Tutorial") _Customize this menu... ; Manage WinEdit Macro menu TheFile=strcat(DirHome(),"System\WINEDIT.MNU") WFileOpen(TheFile) Drop(TheFile)