;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=num2char(9)
        CR=strcat(num2char(13),num2char(10))
        EOL=strcat(num2char(13))
        Home=DirHome()
        IntControl(29,@tab,0,0,0)  ;Standardize on tabs as delimiters for FileItemize, etc

Edit Utility Menu   ; Manage WinEdit Utility menu and help files
        TheFile=strcat(DirHome(),"WINEDIT.MNU")
        WFileOpen(TheFile)
        Drop(TheFile)
;
;Adds a function to load the error file on CTRL-E
;
Read Error File  \^E ; Read WinEdit error file menu and help files
        wViewOutput()

Edit Macro Menu   ; Manage WinEdit Macro menu
        ; In the lite and standard versions of WinEdit,
        ; the MACRO.ENC file is not editable.
        ; In the Pro version, the file MACRO.MNU is used
        ; and it can be edited.
        level=2
        a = FileLocate("WINEDIT.INI")
        if FileExist(a) then level=IniReadPvt("WINEDIT","LEVEL","2",a)
        if (level < 2) then Message("Edit Macro Menu","The Macro Menu cannot be edited in the Lite or Standard versions of WinEdit")
        if (level < 2) then exit
        ; else we can edit it
        TheFile=strcat(DirHome(),"MACRO.MNU")
        WFileOpen(TheFile)
        Drop(TheFile)

_Key Word Help      \ +{F1}         ; Load help topic for word at cursor
        call("wwwedit.dll","KEYWORDHELP")
;
Insert Block
 If-Else
     wEdNewLine()
     wEdUpLine()
     ; First determine if it is C or WIL
     ;debug(1)
     filext = FileExtension(wGetFileName())
     if filext=="WBT" || filext=="WIL" || filext=="MNU"   ; Its WIL
        wEdInsString("if  xx == yy")
        wEdNewLine()
        wEdNewLine()
        wEdInsString("else")
        wEdNewLine()
        wEdNewLine()
        wEdInsString("endif")
        wEdNewLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
     else  ;assume C
        wEdInsString("if  ( xx == yy )")
        wEdNewLine()
        wEdInsString("   {")
        wEdNewLine()
        wEdNewLine()
        wEdInsString("}")
        wEdNewLine()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdInsString("else")
        wEdNewLine()
        wEdInsString("   {")
        wEdNewLine()
        wEdNewLine()
        wEdInsString("}")
        wEdNewLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
     endif
     drop(s,filext)
 Switch
     wEdNewLine()
     wEdUpLine()
     filext = FileExtension(wGetFileName())
     if filext=="WBT" || filext=="WIL" || filext=="MNU"   ; Its WIL
        wEdNewLine()
        wEdUpLine()
        wEdInsString("switch switchvar")
        wEdNewLine()
        wEdInsString("   case 1")
        wEdNewLine()
        wEdInsString("   break")
        wEdNewLine()
        wEdNewLine()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdInsString("case 2")
        wEdNewLine()
        wEdInsString("   break")
        wEdNewLine()
        wEdNewLine()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdInsString("case 3")
        wEdNewLine()
        wEdInsString("   break")
        wEdNewLine()
        wEdNewLine()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdInsString("endswitch")
        wEdNewLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
     else  ;assume C
        wEdInsString("switch (swvar)")
        wEdNewLine()
        wEdInsString("   {")
        wEdNewLine()
        wEdInsString("case 1:")
        wEdNewLine()
        wEdInsString("   break;")
        wEdNewLine()
        wEdNewLine()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdInsString("case 2:")
        wEdNewLine()
        wEdInsString("   break;")
        wEdNewLine()
        wEdNewLine()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdInsString("case 3:")
        wEdNewLine()
        wEdInsString("   break;")
        wEdNewLine()
        wEdNewLine()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdLeft()
        wEdInsString("   }")
        wEdNewLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
        wEdUpLine()
     endif
     drop(s,filext)
 While
     wEdNewLine()
     wEdUpLine()
     filext = FileExtension(wGetFileName())
     if filext=="WBT" || filext=="WIL" || filext=="MNU"   ; Its WIL
        wEdInsString("while xx == yy")
        wEdNewLine()
        wEdNewLine()
        wEdInsString("endwhile")
        wEdNewLine()
        wEdUpLine()
        wEdUpLine()
     else  ;assume C
        wEdInsString("while (xx == yy)")
        wEdNewLine()
        wEdInsString("   {")
        wEdNewLine()
        wEdNewLine()
        wEdInsString("}")
        wEdNewLine()
        wEdUpLine()
        wEdUpLine()
     endif
     drop(s,filext)
 Comment block       \ +^B
        filext = FileExtension(wGetFileName())
        if filext=="WBT" || filext=="WIL" || filext=="MNU"  then cmt=";" ; Its WIL
              else cmt="//"
        s=""
        ;if wGetSelState() then
        s=wEdGetWord()
        clipput ("%cmt%***************************************************************************%CR%")
        clipappend("%cmt%** %s%%CR%")
        clipappend("%cmt%** %CR%")
        clipappend("%cmt%** %CR%")
        clipappend ("%cmt%***************************************************************************%CR%")
        wEDgotocol(1) ;insert above current line
        wedstartsel()
        wedendsel()
        wednewline()
        wEDgotocol(1) ;insert above current line
        Wedpaste()
        weddownline()
        weddownline()
        wedend()
        drop(s,filext,cmt)
;
;Builds a DETAILED comment block from the label under the cursor.
;
 Comment SUPER block       \ ^!B
        filext = FileExtension(wGetFileName())
        if filext=="WBT" || filext=="WIL" || filext=="MNU"  then cmt=";" ; Its WIL
              else cmt="//"
        s=""
        ;if wGetSelState() then
        s=wEdGetWord()
        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%")
        wEDgotocol(1) ;insert above current line
        wedstartsel()
        wedendsel()
        wednewline()
        wEDgotocol(1) ;insert above current line
        Wedpaste()
        weddownline()
        weddownline()
        wedend()
        drop(s,filext,cmt)
;
;Merge File header comment file from disk
;
;Header Block    \ ^!H
;        Wedgotoline(1)
;        WedGotoCol(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)

Load Help File                    ; Load a help file (no keyword lookup)
        TheFile=strcat(DirHome(),"HELP\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)
;
; Open the file under the cursor or marked
;
Open highlighted file    \ ^F       ; Open selected file
        name = wEdGetWord()
        length = strlen(name)
        if length==0 then goto DONE
        b = FileLocate(name)
        if b == "" then Message("Open selected file","Cannot find %name%")
        if b == "" then goto DONE
        wFileOpen(b)
        :DONE
        drop(name,length,b)
;
;
;        
;Delete to end of word. A real, proper, sane one. Like the good old days!
;If the cursor is in/before text, the rest of the word will be deleted.
;If the cursor is in whitespace, the rest of the whitespace will be deleted
;If the cursor is at the end of line, the next line will be concatinated
;
;
Delete to end of word   \ ^T
        col = wgetcolno()             ;save current posn
        wedend()
        e = wgetcolno()               ;Find end of line
        if col>=e then goto Dend      ;end of line -- do delete! (concat lines)
        wedgotocol(col)               ;back where we started
        c1=wgetchar()
        wEdStartSel()
        :loop
        wedright()
        if wgetcolno() < e then c=wgetchar()
        else c=""
        if !strcmp(c1," ") then if !strcmp(c," ") then goto loop
        if strcmp(c1," ") then if strlen(c) then if strcmp(c,"!")>=0 then if ((strcmp(c,":")<0) || (strcmp(c,"?")>0)) then goto loop
        wEdEndSel()
        :Dend
        wEdDelete()
        drop(c)
;
;
;

Generate C Tags                   ; Index source files
        ; uses the TAGS.EXE program to generate WINEDIT.MRK file
        ; that the next function uses to look up function names
        ; in your source
        RunWait("TAGS.EXE","-om -tWINEDIT.MRK *.c")
        Message("Tags","Processing complete")

Go to tag                         ; Jump to function definition
        ; looks up the current word in WINEDIT.MRK, loads the file,
        ; and moves the cursor to the correct line
        ;DEBUG(1)
        goto START
        :GETWORD
        a = AskLine("Go to tag", "Enter function definition to jump to:", "")
        strupper(a)
        len = strlen(a)
        if len==0 then goto NOWORD
        goto START2
        :START
        a=WEdGetWord()
        strupper(a)
        len = strlen(a)
        if len==0 then goto GETWORD
        :START2
        b=FileLocate("winedit.mrk")
        WFileOpen(b)
        WFind(a,@TRUE,@FALSE)
        WEdHome()
        WEdStartSel()
        WEdEnd()
        WEdEndSel()
        WEdCopy()
        WWinClose()
        line=ClipGet()
        line2=strupper(line)
        c=StrIndex(line2,a,0,@FWDSCAN)
        d=StrIndex(line2," ",c,@FWDSCAN)
        e=StrIndex(line2,"(",d,@FWDSCAN)
        filename=StrSub(line2,d,e-d)
        lineno=StrSub(line2,e+1,strlen(line2)-e-1)
        WFileOpen(filename)
        WEdGoToLine(lineno)
        WEdHome()
        Drop(len,b,line,line2,c,d,e,filename,lineno)
        :NOWORD
        Drop(a)
;

Grep    \      ^G             ; Run fgrep
        a = "fgrep.com"
        b = FileLocate(strcat(DirHome(),a))
        if b=="" then b=FileLocate(a)
        if b=="" then Message("Error","Fgrep utility not found.  You can download fgrep.com from our BBS.  (206)935-5198")
                 then goto DONE
        GrepWord = wEdGetWord()         ; Get Selected word if any
        command = AskLine("Grep","Enter the grep commmand to run:","tee.com %b% -M %GrepWord% *.c")
        wRunCommand(command,@TRUE,@TRUE)
        :DONE
        Drop(command,GrepWord,a,b);


;Multifile grep command. Expects to fine unix-compatable grep AND gres
;commands in the path!  It parses the result into an error file so that 
;next and previous error works 
;

;Grep    \      ^G             ; Run fgrep
;        Tee=strcat(DirHome(),"tee.com")
;        Where=strlower(StrSub(dirget(),1,strlen(dirget())-1))
;        drv=StrSub(Where,1,2)
;        ext=strlower(fileExtension(wGetFilename()))
;        if (ext=="c"|ext=="h") then ext = "?"
;        GrepWord = wEdGetWord()         ; Get Selected word if any
;        command = GrepWord
;        command = AskLine("Grep (multifile)","Drive:  %drv%   Dir:  %Where% %CR% %CR%Enter text to find: ","%GrepWord%")
;        wRunCommand("grep -n %command% %Where%\*.%ext%|gres '^(..[^:]*)(: )([0-9][0-9]*)(: )' '\1 \3 Error:'",@TRUE,@TRUE)
;        Drop(command,GrepWord,Tee,Where,drv)
;


;Improved toggle-case macro for Winedit 3.1
;
Toggle case     \ ^Q
        a = wGetSelState()
        if a == 1 then goto selection
        a = wGetChar()
        if (a == StrLower(a)) then a = StrUpper(a)
        else a = StrLower(a)
        wEdDelete()
        wEdInsString(a)
        Drop(a)
        exit
        :selection
        line = wGetLineNo()
        col = wGetColNo()
        wEdCut()
        a=clipget()
        if (a == StrLower(a)) then ClipPut(StrUpper(a))        
        else ClipPut(StrLower(a))        
        wEdPaste()
        wEdStartSel()
        wEdGotoLine(line)
        wEdGotoCol(col)
        wEdEndSel()
        drop (a,line,col)
;
;Version Control for use with RCS
;
;&Version Control           ; RCS commands
; 
;; Lock/get file (co -l)  \ ^!F
;;        opt2="-l"
;;        goto lgf2
; Get file (co)          \ ^!O  
;        opt2=""
;        :lgf2
;        Where=StrSub(dirget(),1,strlen(dirget())-1)
;        drv=StrSub(Where,1,2)
;        b=wGetFileName()
;        if b==1 then b=""
;        if wGetSelState() then s=wEdGetWord()
;           else s=b
;        a = AskLine("RCS Checkout %opt2%", "Drive:  %drv%   Dir:  %Where% %CR% %CR%Enter file you want to lock:", s)
;        ParseData(a)
;        s=fileroot(param%param0%)
;        if s==fileroot(b) then wWinClose()
;           else if b!="" then if AskYesNo("%a% is not the active file.%CR% %CR%Close Files","Close all files before continuing?")==@YES then wWinCloseall()
;
;;OS/2 Version
;;        wRunCommand("%drv% |cd %Where%|wetee co %opt2% %a%",@FALSE,@TRUE)
;;        pause("OS/2 Bug","Tell the stupid OS/2 when the program is done!")
;;DOS/WIN Version
;        wRunCommand("%drv% |cd %Where%|wetee co %opt2% %a%",@TRUE,@TRUE)
;      
;         Wfileopen(b)
;        b=FileLocate(a)
;        if b=="" then goto NotFound
;          WFileOpen(b)
;          goto DONE
;        :NotFound
;          Message("Sorry", "%a% not found...")
;          goto Done
;        :DONE
;        Drop(a)
;        Drop(b,Where,drv,s)
;
; Checkin file (ci)     \ ^!I
;        Where=StrSub(dirget(),1,strlen(dirget())-1)
;        drv=StrSub(Where,1,2)
;        b=wGetFileName()
;        if b==1 then b=""
;        if wGetSelState() then s=wEdGetWord()
;           else s=b
;        a = AskLine("RCS Checkin (unlock)", "Drive:  %drv%   Dir:  %Where% %CR% %CR%Enter file you want to put back:",s )
;        ParseData(a)
;        s=fileroot(param%param0%)
;        if s==fileroot(b) then wWinClose() 
;           else if AskYesNo("%a% is not the active file.%CR% %CR%Close Files","Close all files before continuing?")==@YES then wWinCloseall()
;        wRunCommand("%drv% |cd %Where%|wetee ci %a%",@TRUE,@TRUE)
;;(if OS/2)     pause("OS/2 Bug","Tell the stupid OS/2 when the program is done!")
;        wfileopen(b) ; reopen original window
;        Drop(a,Where,drv,b,s)
;
; Enter any command (clean)     \ ^!C
;        Where=StrSub(dirget(),1,strlen(dirget())-1)
;        drv=StrSub(Where,1,2)
;        b=wGetFileName()
;        if b==1 then b=""
;        if wGetSelState() then s=wEdGetWord()
;           else s=strcat("rcsclean ",b)
;        a = AskLine("Any Command", "Drive:  %drv%   Dir:  %Where% %CR% %CR%Enter command:", s)
;        ParseData(a)
;        s=fileroot(param%param0%)
;        if s==fileroot(b) then wWinClose()
;           else if AskYesNo("Close Files","%S% is not the active file.%CR% %CR%Close all files before continuing?")==@YES then wWinCloseall()
;        wRunCommand("%drv% |cd %Where%|%a%",@TRUE,@TRUE)
;;if OS/2        pause("OS/2 Bug","Tell the stupid OS/2 when the program is done!")
;        wfileopen(b)
;        Drop(a,b,s,Where,drv)
;
;; &Logfile Info (locked)
;;        a = AskLine("PVCS Logfile Command", "Drive:  %drv%   Dir:  %Where% %CR% %CR%Enter file for which you want logfile info:", "")
;;        a=strcat("tee vlog -BL ",a)
;;        wRunCommand(a,@TRUE,@TRUE)
;;        Drop(a,Where,drv)
;
;; &Update all source files
;;        wRunCommand("tee get -u *.??v",@TRUE,@TRUE)
;
;
;&Version Control          ; PVCS commands
; &Get a file (w/lock)
;        a = AskLine("PVCS Get (w/lock) Command", "Enter file you want to lock:", "")
;        b=strcat("tee get -L ",a)
;        wRunCommand(b,@TRUE,@TRUE)
;        Drop(b)
;        b=FileLocate(a)
;        if b=="" then goto NotFound
;          WFileOpen(b)
;          goto DONE
;        :NotFound
;          Message("???", "%a% not found...")
;          goto Done
;        :DONE
;        Drop(a)
;        Drop(b)
;
; &Put a file back (unlock)
;        a = AskLine("PVCS Put (unlock) Command", "Enter file you want to put back:", "")
;        a=strcat("tee put ",a)
;        wRunCommand(a,@TRUE,@TRUE)
;        Drop(a)
;
; &Enter any PVCS command
;        a = AskLine("PVCS Command", "Enter PVCS command:", "")
;        a=strcat("tee ",a)
;        wRunCommand(a,@TRUE,@TRUE)
;        Drop(a)
;
; &Logfile Info (locked)
;        a = AskLine("PVCS Logfile Command", "Enter file for which you want logfile info:", "")
;        a=strcat("tee vlog -BL ",a)
;        wRunCommand(a,@TRUE,@TRUE)
;        Drop(a)
;
; &Update all source files
;        wRunCommand("tee get -u *.??v",@TRUE,@TRUE)
;
;;

Utilities      ;      Select from list of utilities
 &Freespace on Local Drives   ; Display free disk space on drives

        Drive=DiskScan(2)     ; 2 is the code for local hard drives
        Dmax=strlen(Drive)
        DIndex=1
        TotalSize=0
        DriveReport=""

        :COUNTSPACE
        NextDrive=StrSub(Drive,Dindex,1)
        a=DiskFree(NextDrive)/1024
        TotalSize=a+TotalSize
        DriveReport=strcat(DriveReport,NextDrive," = ",a,"K","@")
        DIndex=Dindex+3  ;each entry is 3 bytes long
        if DIndex<=Dmax then goto COUNTSPACE
        ItemSelect("Total Space Available = %TotalSize%K",DriveReport,"@")
        Drop(xxx,TotalSize,DriveReport,NextDrive,LastDrive)
 
 &Wallpaper                   ; Change the desktop wallpaper
           DirChange(dirWindows(0))
           a=FileItemize("*.BMP")
           a=strcat("-None- ",a)
           a=ItemSelect("Select New Wallpaper",a,@tab)
           terminate(a=="","Wallpaper","No wallpaper selected")
           if a=="-None-" then Wallpaper("",0)
           if a=="-None-" then exit
           tile=@FALSE
           if FileSize(a)<40000 then tile=@TRUE  
           ;if bmp size less than 40K, assume tile, else center
           Wallpaper(a,tile)
           drop(a,b,tile)
        exit

 Paste Special Characters             ; Paste high ASCII characters to clipboard or document
  Copy &FormFeed to Clipboard
       Clipput(Num2char(12))
  Copy &Special Characters to Document
       a=" ¡| ¢| £| ¤| ¥| ¦| §| ¨| ©| ª|"       ;161 thru 170
       b=" «| ¬| ­| ®| ¯| °| ±| ²| ³| ´|"       ;171 thru 180
       c=" µ| ¶| ·| ¸| ¹| º| »| ¼| ½| ¾|"       ;181 thru 190
       d=" ¿| À| Á| Â| Ã| Ä| Å| Æ| Ç| È|"       ;191 thru 200
       e=" É| Ê| Ë| Ì| Í| Î| Ï| Ð| Ñ| Ò|"       ;201 thru 210
       f=" Ó| Ô| Õ| Ö| ×| Ø| Ù| Ú| Û| Ü|"       ;211 thru 220
       g=" Ý| Þ| ß| à| á| â| ã| ä| å| æ|"       ;221 thru 230
       h=" ç| è| é| ê| ë| ì| í| î| ï| ð|"       ;231 thru 240
       i=" ñ| ò| ó| ô| õ| ö| ÷| ø| ù| ú|"       ;241 thru 250
       j=" û| ü| ý| þ| ÿ"                       ;251 thru 255
       a=strcat(a,b,c,d,e,f,g,h,i,j)
       Drop(b,c,d,e,f,g,h,i,j)
       a=ItemSelect("Choose a character",a,"|")
       a=strsub(a,2,1)
       wEdInsString(a)
       Drop(a)


_&System Information
       wintype="retail"
       if WinMetrics(22) then wintype="debug"
        wcx=WinMetrics(-3)
        math="Math"
        switch wcx
           case 0   ; Win16
                wc=WinConfig()
                if !(wc&1) then mode="Real"
                if wc&16 then mode="Standard"
                if wc&32 then mode="Enhanced"
                
                if wc&64 then cpu=8086
                if wc&128 then cpu=80186
                if wc&2 then cpu=286
                if wc&4 then cpu=386
                if wc&8 then cpu=486
                mode = strcat(mode,' ',wintype,' Windows ')
                if !(wc&1024)  then math="No math"
                break
          case 1 ; Win32 Intel
               mode="Intel 32-bit %wintype% Windows "
               cpu= ItemExtract(6,WinSysInfo(),@tab)
               break
          case 2 ; Dec Alpha
               mode="DEC Alpha %wintype% Windows NT "
               cpu= ItemExtract(6,WinSysInfo(),@tab)
               break
          case 3 ; MIPS
               mode="MIPS %wintype% Windows NT "
               cpu= ItemExtract(6,WinSysInfo(),@tab)
               break
          case 4 ; PowerPC 
               mode="PowerPC %wintype% Windows NT "
               cpu= ItemExtract(6,WinSysInfo(),@tab)
               break
          case wcx
               cpu= ItemExtract(6,WinSysInfo(),@tab)
               mode="Unknown platform %wintype% Windows  "
        endswitch

        Sysinfo=strcat(cpu,' ',mode,WinVersion(1),'.',WinVersion(0),@CRLF)

        mouse="No Mouse"
        if WinMetrics(19) then mouse="Mouse"

        Sysinfo=strcat(sysinfo,math," co-processor.   ",mouse,' available.',@CRLF)

        sysinfo=strcat(sysinfo,WinMetrics(0),'x',WinMetrics(1)," video resolution.  ",WinMetrics(-1),"  colors.",@CRLF)

        ErrorMode(@OFF)
        LastError()
        PlayMedia("Status WaveForm Ready")
        ErrorMode(@CANCEL)
        if LastError()!=1193 then sysinfo=strcat(sysinfo,"Windows multimedia extensions present.",@CRLF)
        a=NetInfo(0)
        if a=="MULTINET"
             b=NetInfo(1)
             bug=strcat(b,"network(s) installed")
             ;Message("Multinet supporting  %count% networks", b)
        else
             ;Message("Installed Network", a)
             bug=strcat(a," network installed")
        endif
        sysinfo=strcat(sysinfo,bug,@crlf)


        switch wcx
           case 0
               bug=WinResources(0)/1024   ; Compute memory avail
               math=strlen(bug)
               if math>3 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
          if !IsDefined(uyit65) then uyit65="Message( , )"
          :NEXT
          uyit65=AskLine("Interactive Execution","Enter Command",uyit65)
          execute %uyit65%
          goto NEXT
          
_Run a WIL Script File
         if wGetModified()==@TRUE then wFileSave()
         TheFile = WGetFileName()
         Call(TheFile,"")

        
