home *** CD-ROM | disk | FTP | other *** search
/ HomeWare 14 / HOMEWARE14.bin / windows / editprog / we_30x.arj / WINEDIT.MN_ < prev    next >
Text File  |  1994-05-20  |  15KB  |  452 lines

  1. ; AutoExec Section is on top here.  Actually runs before file manager
  2. ; appears on the screen
  3. ;
  4.         TAB=num2char(9)
  5.         CR=strcat(num2char(13),num2char(10))
  6.         Home=DirHome()
  7.  
  8. Edit Utility Menu   ; Manage WinEdit Utility menu and help files
  9.         TheFile=strcat(DirHome(),"WINEDIT.MNU")
  10.         WFileOpen(TheFile)
  11.         Drop(TheFile)
  12.  
  13. Edit Macro Menu   ; Manage WinEdit Macro menu
  14.         ; In the lite and standard versions of WinEdit,
  15.         ; the MACRO.ENC file is not editable.
  16.         ; In the Pro version, the file MACRO.MNU is used
  17.         ; and it can be edited.
  18.         level=2
  19.         a = FileLocate("WINEDIT.INI")
  20.         if FileExist(a) then level=IniReadPvt("WINEDIT","LEVEL","2",a)
  21.         if (level < 2) then Message("Edit Macro Menu","The Macro Menu cannot be edited in the Lite or Standard versions of WinEdit")
  22.         if (level < 2) then exit
  23.         ; else we can edit it
  24.         TheFile=strcat(DirHome(),"MACRO.MNU")
  25.         WFileOpen(TheFile)
  26.         Drop(TheFile)
  27.  
  28. _Key Word Help      \ +{F1}         ; Load help topic for word at cursor
  29.         call("wwwedit.dll","KEYWORDHELP")
  30.  
  31. Load Help File                    ; Load a help file (no keyword lookup)
  32.         TheFile=strcat(DirHome(),"HELP\WEHELP.INI")
  33.         Keys=IniItemizePvt("HelpAll",TheFile)
  34.         KeyMax=ItemCount(Keys,TAB)
  35.         KeyIndex=0
  36.         KeyValues=""
  37.  
  38.         :ieLoop
  39.         if KeyIndex==KeyMax then goto looped
  40.         KeyIndex=KeyIndex+1
  41.         ThisKey=ItemExtract(KeyIndex,Keys,TAB)
  42.         if (stricmp(ThisKey,"DEFAULT")==0) then goto ieloop
  43.         ThisValue=IniReadPvt("HelpAll",ThisKey,"???",TheFile)
  44.         KeyValues=strcat(KeyValues,ThisValue,"|")
  45.         goto ieLoop
  46.         
  47.         :looped
  48.         a=ItemSelect("Select Help File",strlower(KeyValues),"|")
  49.         if a=="" then goto DONE
  50.         b = FileLocate(strcat(DirHome(),"HELP\%a%"))
  51.         if b=="" then b=FileLocate(a)
  52.         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.")
  53.                  else WinHelp(b,"CONTENTS","")
  54.         :DONE
  55.         Drop(TheFile,Keys,KeyMax,KeyIndex,KeyValues,ThisKey,ThisValue,a,b)
  56.  
  57. Open highlighted file           ; Open highlighted file
  58.         name = wEdGetWord()
  59.         length = strlen(name)
  60.         if length==0 then goto DONE
  61.         b = FileLocate(name)
  62.         if b == "" then Message("Open highlighted file","Cannot find %name%")
  63.         if b == "" then goto DONE
  64.         wFileOpen(b)
  65.         :DONE
  66.         drop(name,length)
  67.  
  68. Generate C Tags                   ; Index source files
  69.         ; uses the TAGS.EXE program to generate WINEDIT.MRK file
  70.         ; that the next function uses to look up function names
  71.         ; in your source
  72.         RunWait("TAGS.EXE","-om -tWINEDIT.MRK *.c")
  73.         Message("Tags","Processing complete")
  74.  
  75. Go to tag                         ; Jump to function definition
  76.         ; looks up the current word in WINEDIT.MRK, loads the file,
  77.         ; and moves the cursor to the correct line
  78.         ;DEBUG(1)
  79.         goto START
  80.         :GETWORD
  81.         a = AskLine("Go to tag", "Enter function definition to jump to:", "")
  82.         strupper(a)
  83.         len = strlen(a)
  84.         if len==0 then goto NOWORD
  85.         goto START2
  86.         :START
  87.         a=WEdGetWord()
  88.         strupper(a)
  89.         len = strlen(a)
  90.         if len==0 then goto GETWORD
  91.         :START2
  92.         b=FileLocate("winedit.mrk")
  93.         WFileOpen(b)
  94.         WFind(a,@TRUE,@FALSE)
  95.         WEdHome()
  96.         WEdStartSel()
  97.         WEdEnd()
  98.         WEdEndSel()
  99.         WEdCopy()
  100.         WWinClose()
  101.         line=ClipGet()
  102.         line2=strupper(line)
  103.         c=StrIndex(line2,a,0,@FWDSCAN)
  104.         d=StrIndex(line2," ",c,@FWDSCAN)
  105.         e=StrIndex(line2,"(",d,@FWDSCAN)
  106.         filename=StrSub(line2,d,e-d)
  107.         lineno=StrSub(line2,e+1,strlen(line2)-e-1)
  108.         WFileOpen(filename)
  109.         WEdGoToLine(lineno)
  110.         WEdHome()
  111.         Drop(len,b,line,line2,c,d,e,filename,lineno)
  112.         :NOWORD
  113.         Drop(a)
  114.  
  115.  
  116. Grep    \      ^G             ; Run fgrep
  117.         GrepWord = wEdGetWord()         ; Get Selected word if any
  118.         command = AskLine("Grep","Enter the grep commmand to run:","tee.com fgrep -M %GrepWord% *.c")
  119.         wRunCommand(command,@TRUE,@TRUE)
  120.         Drop(command,GrepWord);
  121.  
  122. Toggle case     \ ^U
  123.         a = wGetSelState()
  124.         if a == 1 then goto selection
  125.         char = wGetChar()
  126.         if Uppercase == 1 then char = StrUpper(char)
  127.         else char = StrLower(char)
  128.         if Uppercase == 1 then Uppercase = 0 
  129.         else Uppercase = 1
  130.         wEdDelete()
  131.         wEdInsString(char)
  132.         wEdLeft()
  133.         Drop(a,char)
  134.         exit
  135.         :selection
  136.         line = wGetLineNo()
  137.         col = wGetColNo()
  138.         wEdCut()
  139.         if Uppercase == 1 then ClipPut(StrUpper(ClipGet()))        
  140.         else ClipPut(StrLower(ClipGet()))        
  141.         wEdPaste()
  142.         wEdStartSel()
  143.         wEdGotoLine(line)
  144.         wEdGotoCol(col)
  145.         wEdEndSel()
  146.         if Uppercase == 1 then Uppercase = 0 
  147.         else Uppercase = 1
  148.         
  149. &Version Control          ; PVCS commands
  150.  &Get a file (w/lock)
  151.         a = AskLine("PVCS Get (w/lock) Command", "Enter file you want to lock:", "")
  152.         b=strcat("tee get -L ",a)
  153.         wRunCommand(b,@TRUE,@TRUE)
  154.         Drop(b)
  155.         b=FileLocate(a)
  156.         if b=="" then goto NotFound
  157.           WFileOpen(b)
  158.           goto DONE
  159.         :NotFound
  160.           Message("???", "%a% not found...")
  161.           goto Done
  162.         :DONE
  163.         Drop(a)
  164.         Drop(b)
  165.  
  166.  &Put a file back (unlock)
  167.         a = AskLine("PVCS Put (unlock) Command", "Enter file you want to put back:", "")
  168.         a=strcat("tee put ",a)
  169.         wRunCommand(a,@TRUE,@TRUE)
  170.         Drop(a)
  171.  
  172.  &Enter any PVCS command
  173.         a = AskLine("PVCS Command", "Enter PVCS command:", "")
  174.         a=strcat("tee ",a)
  175.         wRunCommand(a,@TRUE,@TRUE)
  176.         Drop(a)
  177.  
  178.  &Logfile Info (locked)
  179.         a = AskLine("PVCS Logfile Command", "Enter file for which you want logfile info:", "")
  180.         a=strcat("tee vlog -BL ",a)
  181.         wRunCommand(a,@TRUE,@TRUE)
  182.         Drop(a)
  183.  
  184.  &Update all source files
  185.         wRunCommand("tee get -u *.??v",@TRUE,@TRUE)
  186.  
  187. Utilities      ;      Select from list of utilities
  188.  &Freespace on Local Drives   ; Display free disk space on drives
  189.  
  190.         Drive=DiskScan(2)     ; 2 is the code for local hard drives
  191.         Dmax=strlen(Drive)
  192.         DIndex=1
  193.         TotalSize=0
  194.         DriveReport=""
  195.  
  196.         :COUNTSPACE
  197.         NextDrive=StrSub(Drive,Dindex,1)
  198.         a=DiskFree(NextDrive)/1024
  199.         TotalSize=a+TotalSize
  200.         DriveReport=strcat(DriveReport,NextDrive," = ",a,"K","@")
  201.         DIndex=Dindex+3  ;each entry is 3 bytes long
  202.         if DIndex<=Dmax then goto COUNTSPACE
  203.         ItemSelect("Total Space Available = %TotalSize%K",DriveReport,"@")
  204.         Drop(xxx,TotalSize,DriveReport,NextDrive,LastDrive)
  205.  
  206.  &Wallpaper                   ; Change the desktop wallpaper
  207.            DirChange(dirWindows(0))
  208.            a=FileItemize("*.BMP")
  209.            a=strcat("-None- ",a)
  210.            a=ItemSelect("Select New Wallpaper",a," ")
  211.            terminate(a=="","Wallpaper","No wallpaper selected")
  212.            if a=="-None-" then Wallpaper("",0)
  213.            if a=="-None-" then exit
  214.            tile=@FALSE
  215.            if FileSize(a)<40000 then tile=@TRUE  
  216.            ;if bmp size less than 40K, assume tile, else center
  217.            Wallpaper(a,tile)
  218.            drop(a,b,tile)
  219.  Edit &INI files              ; Assisted editing of INI files
  220.         DirChange(DirWindows(0))
  221.         canned="BYEBYE"
  222.         IniFiles=""
  223.  
  224.         :UP1
  225.         canned="byebye"
  226.         If IniFiles!="" then goto inied
  227.         IniFiles=FileItemize("*.INI")
  228.         :inied
  229.         TheFile=ItemSelect("Choose Desired INI file",IniFiles," ")
  230.         if TheFile=="" then goto newini
  231.         Sections=""
  232.  
  233.         :UP2
  234.         canned="up1"
  235.         if Sections!="" then goto sected
  236.         Sections=IniItemizePvt("",TheFile)
  237.         :SECTED
  238.         Section=ItemSelect("%TheFile% - Choose Section",Sections,TAB)
  239.         if Section=="" then goto AddSect
  240.         KeyValues=""
  241.  
  242.         :UP3
  243.         canned="up2"
  244.         if KeyValues!="" then goto looped
  245.         Keys=IniItemizePvt(Section,TheFile)
  246.         KeyMax=ItemCount(Keys,TAB)
  247.         KeyIndex=0
  248.  
  249.         :Loop
  250.         if KeyIndex==KeyMax then goto looped
  251.         KeyIndex=KeyIndex+1
  252.         ThisKey=ItemExtract(KeyIndex,Keys,TAB)
  253.         ThisValue=IniReadPvt(Section,ThisKey,"???",TheFile)
  254.         KeyValues=strcat(KeyValues,ThisKey,"= ",ThisValue,TAB)
  255.         goto Loop
  256.  
  257.         :looped
  258.         Key=ItemSelect("%TheFile% [%Section%] - Choose Keyword",KeyValues,TAB)
  259.         if Key=="" then goto AddKey
  260.         Key=ItemExtract(1,Key,"=")
  261.  
  262.         Value=IniReadPvt(Section,Key,"???",TheFile)
  263.         goto entkey
  264.  
  265.  
  266.         :newini
  267.         canned="UP1"
  268.         TheFile=Askline("Making NEW INI file","Enter new INI file name","*.INI")
  269.         if (TheFile=="*.INI" || TheFile=="") then goto newini
  270.         IniFIles=""
  271.         goto AddSectNewIni
  272.  
  273.         :AddSect
  274.         canned="up2"
  275.         :AddSectNewIni
  276.         Section=AskLine("Add New Section to INI File","Enter new section name for%CR%   %TheFile%%CR%      [?????]","")
  277.         Sections=""
  278.         goto AddKeyNewSect
  279.  
  280.         :AddKey
  281.         canned="up3"
  282.         :AddKeyNewSect
  283.         Key=AskLine("Add New Keyword to INI File","Enter new key name for%CR%   %TheFile%%CR%      [%Section%]","")
  284.         Value="(Undefined)"
  285.         KeyValues=""
  286.         goto EntKeyNewKey
  287.  
  288.         :ENTKEY
  289.         canned="up3"
  290.         :EntKeyNewkey
  291.         NewValue=AskLine("Modify INI File Keyword","%TheFile%%CR%   [%Section%]%CR%      %Key% = %Value%",Value)
  292.         if NewValue!=Value then iniwritepvt(Section,Key,NewValue,TheFile)
  293.         KeyValues=""
  294.         goto up3
  295.  
  296.         :CANCEL
  297.         goto %Canned%
  298.  
  299.         :BYEBYE
  300.         exit
  301.  
  302.  Paste Special Characters             ; Paste high ASCII characters to clipboard or document
  303.   Copy &FormFeed to Clipboard
  304.        Clipput(Num2char(12))
  305.   Copy &Special Characters to Document
  306.        a=" í| ó| ú| ñ| Ñ| ª| º| ¿| ⌐| ¬|"       ;161 thru 170
  307.        b=" ½| ¼| ¡| «| »| ░| ▒| ▓| │| ┤|"       ;171 thru 180
  308.        c=" ╡| ╢| ╖| ╕| ╣| ║| ╗| ╝| ╜| ╛|"       ;181 thru 190
  309.        d=" ┐| └| ┴| ┬| ├| ─| ┼| ╞| ╟| ╚|"       ;191 thru 200
  310.        e=" ╔| ╩| ╦| ╠| ═| ╬| ╧| ╨| ╤| ╥|"       ;201 thru 210
  311.        f=" ╙| ╘| ╒| ╓| ╫| ╪| ┘| ┌| █| ▄|"       ;211 thru 220
  312.        g=" ▌| ▐| ▀| α| ß| Γ| π| Σ| σ| µ|"       ;221 thru 230
  313.        h=" τ| Φ| Θ| Ω| δ| ∞| φ| ε| ∩| ≡|"       ;231 thru 240
  314.        i=" ±| ≥| ≤| ⌠| ⌡| ÷| ≈| °| ∙| ·|"       ;241 thru 250
  315.        j=" √| ⁿ| ²| ■|  "                       ;251 thru 255
  316.        a=strcat(a,b,c,d,e,f,g,h,i,j)
  317.        Drop(b,c,d,e,f,g,h,i,j)
  318.        a=ItemSelect("Choose a character",a,"|")
  319.        a=strsub(a,2,1)
  320.        wEdInsString(a)
  321.        Drop(a)
  322.  
  323.  
  324. Accessories
  325.  Appointment   Scheduling
  326.            run("Calendar.exe","")
  327.  Calculator
  328.            run("calc.exe","")
  329.  
  330.  C&lipboard
  331.         errormode(@off)
  332.         terminate(winactivate("Clipboard"),"","") ;Already Running
  333.         errormode(@cancel)
  334.         run("Clipbrd.exe","")
  335.  
  336.  Clock
  337.         run("clock.exe","")
  338.  
  339.  Control &Panel
  340.         errormode(@off)
  341.         terminate(winactivate("Control Panel"),"","")
  342.         errormode(@cancel)
  343.         run("control.exe","")
  344.  Cardfile
  345.            run("cardfile.exe","")
  346.  
  347.  Notepad Editor
  348.            run("notepad.exe","")
  349.  
  350.  Paint
  351.            run("pbrush.exe","")
  352.  
  353.  Write
  354.            run("write.exe","")
  355.  
  356.  Run System Confi&guration Editor
  357.            run("sysedit.exe","")  ;takes care of itself
  358.  
  359.  Run W&indows Program
  360.          TheFile=Askline("Run a Window Program","Enter Windows program:","")
  361.          run(Thefile,"")  ;takes care of itself
  362.  
  363.  Run Windows Setup
  364.         DirChange(DirWindows(0))
  365.         run("setup.exe","")
  366.         drop(a)
  367.  
  368.  _PIF Edi&t...
  369.         DirChange(FilePath(FileLocate("_default.pif")))
  370.         a=FileItemize("*.PIF")
  371.         if a==""  then DirChange(FilePath(FileLocate("_default.pif")))
  372.         if a=="" then a=FileItemize("*.PIF")
  373.         a=ItemSelect("Choose a PIF File to edit",a," ")
  374.         run("pifedit.exe",a)
  375.         exit
  376. _&System Information
  377.        wintype="retail"
  378.        if WinMetrics(22) then wintype="debug"
  379.  
  380.         wc=WinConfig()
  381.         if !(wc&1) then mode="Real"
  382.         if wc&16 then mode="Standard"
  383.         if wc&32 then mode="Enhanced"
  384.  
  385.         if wc&2 then cpu=286
  386.         if wc&4 then cpu=386
  387.         if wc&8 then cpu=486
  388.         if wc&64 then cpu=8086
  389.         if wc&128 then cpu=80186
  390.  
  391.         Sysinfo=strcat(cpu,' ',mode,' ',wintype,' Windows ',WinVersion(1),'.',WinVersion(0),CR)
  392.  
  393.         math="No math"
  394.         if wc&1024 then math="Math"
  395.         mouse="No Mouse"
  396.         if WinMetrics(19) then mouse="Mouse"
  397.  
  398.         Sysinfo=strcat(sysinfo,math," co-processor.   ",mouse,' available.',CR)
  399.  
  400.         sysinfo=strcat(sysinfo,WinMetrics(0),'x',WinMetrics(1)," video resolution.  ",WinMetrics(-1),"  colors.",CR)
  401.  
  402.         ErrorMode(@OFF)
  403.         LastError()
  404.         PlayMedia("Status WaveForm Ready")
  405.         ErrorMode(@CANCEL)
  406.         if LastError()!=1193 then sysinfo=strcat(sysinfo,"Windows multimedia extensions present.",CR)
  407.  
  408.         bug=NetGetCaps(2)
  409.         if bug==0 then math="No n"
  410.         if bug!=0 then math="N"
  411.         if bug==256 then math="Microsoft n"
  412.         if bug==512 then math="Lan Manager n"
  413.         if bug==768 then math="Novell NetWare n"
  414.         if bug==1024 then math="Banyan Vines n"
  415.         if bug==1280 then math="10 Net n"
  416.         sysinfo=strcat(sysinfo,math,"etwork installed.",CR)
  417.  
  418.         bug=WinResources(0)/1024   ; Compute memory avail
  419.         math=strlen(bug)
  420.         if math>3 then bug=strcat(strsub(bug,1,math-3),',',strsub(bug,math-2,3))
  421.  
  422.         sysinfo=strcat(sysinfo,CR,bug," KB Free Memory",CR)
  423.         sysinfo=strcat(sysinfo,WinResources(2),"%% System Resources Free (",WinResources(3),"%% GDI, ",WinResources(4),"%% User)",CR)
  424.  
  425.         sysinfo=strcat(sysinfo,"DOS ",DosVersion(1),'.',DosVersion(0),"  using ",environment("COMSPEC"),CR)
  426.         disks=DiskScan(1)
  427.         if disks!="" then sysinfo=strcat(sysinfo,"Floppies ",disks,CR)
  428.         disks=DiskScan(2)
  429.         if disks!="" then sysinfo=strcat(sysinfo,"Hard Disks ",disks,CR)
  430.         disks=DiskScan(4)
  431.         if disks!="" then sysinfo=strcat(sysinfo,"Network Disks ",disks,CR)
  432.         sysinfo=strcat(sysinfo,"Windows Directory ",DirWindows(0),CR)
  433.         sysinfo=strcat(sysinfo,"System  Directory ",DirWindows(1),CR)
  434.         sysinfo=strcat(sysinfo,CR,"WIL Interpreter Ver ",VersionDll())
  435.  
  436.         ver=Version()
  437.         Message("WinEdit %ver% SysInfo",Sysinfo)
  438.  
  439. Interactive Execution
  440.           if !IsDefined(uyit65) then uyit65="Message( , )"
  441.           :NEXT
  442.           uyit65=AskLine("Interactive Execution","Enter Command",uyit65)
  443.           execute %uyit65%
  444.           goto NEXT
  445.           
  446. _Run a WIL Script File
  447.          if wGetModified()==@TRUE then wFileSave()
  448.          TheFile = WGetFileName()
  449.          Call(TheFile,"")
  450.  
  451.         
  452.