home *** CD-ROM | disk | FTP | other *** search
- ; This is a common WIL script file for the WinBatch Studio
-
- Cancelcmd="exit"
- GOTO %PARAM1%
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- :BUTTONMACRO
- ; we get here via a line like
- ; Call("WSHELP.DLL", "BUTTONMACRO 1") Add a goto label to jump to
- ; a specific section
- ; e.g.
- ; goto butmac%param2%
- ; :butmac1
- ; code here
- ; return
- ; :butmac2
- ; code here
- ; return
- Message("Sample Macro","You called user macro number %param2%")
- EXIT
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- :KEYWORDHELP
-
- ;First do some initialization and grab the word help is desired for.
- ;debug(1)
- Cancelcmd="goto KWHDONE" ; Setup cancel processing - clear variables.
- IF IsDefined(Param2) THEN Helpword=Param2 ; Helpinfo from wspopup.mnu?
- ELSE Helpword = wEdGetWord() ; Get Selected word.
-
- IF Helpword==""
- wLeft() ; End of word? Try one position to the left.
- Helpword = wEdGetWord() ; Select possible word & reset cursor.
- wRight() ; Saves time-wasting manual cursor manipulation.
- ENDIF
-
- IF Helpword==""
- Helpword=AskLine("Help!","Enter command for syntax/help information","Type keyword here")
- ENDIF
-
- IF Helpword==""
- Message("WinBatch Studio Help Error","Cursor must be on a word to use this function.")
- ELSE
- ; Locate our WSHELP.INI file and determine help file list to process
- Wedir = DirHome()
- Inifile = StrCat(Wedir, "HELP\WSHELP.INI")
- IF FileExist(Inifile)==@False THEN Inifile=FileLocate("WSHELP.INI")
- Filext = FileExtension(wGetFileName())
- IF Filext == "" THEN Filext = "NONE" ; Section for files w/no extension.
- Helpsec = IniReadPvt("EXTENSIONS", Filext, "DEFAULT", Inifile)
- Hfnum = 0
- ; Get the next help file from the list,
-
- FOR Hfnum=1 TO 1000
- Ffound=0
- Wehinfo = StrUpper(IniReadPvt(Helpsec, "HF%HFnum%", "NONE", Inifile))
- IF Wehinfo == "NONE"
- Message("WinBatch Studio Help Error - %helpword%", "No applicable help files found.")
- BREAK
- ENDIF
- IF Wehinfo == "" THEN CONTINUE ; Empty HFx setting, skip.
-
- ; Extract and build information from the HFx setting
- Hfr2=StrIndex(Wehinfo," ",0,@Backscan)
- Helpfilei=StrSub(Wehinfo,1,Hfr2-1) ; Long File Name Fix.
- Wehfile = StrCat(Wedir, "HELP\",FileRoot(Helpfilei), ".WEH")
- IF FileExist(Wehfile)==@False THEN Wehfile=FileLocate(StrCat(FileRoot(Helpfilei),".WEH"))
- Wehtype=StrSub(Wehinfo,Hfr2+1,-1)
-
- ; Make sure we have a WEH file someplace
-
- IF !(FileExist(Wehfile)) THEN CONTINUE ; Skip missing help file.
-
- ; Read Keyword data from WEH file
- Wehdata=IniReadPvt("KEYWORDS",Helpword,"",Wehfile)
- IF Wehdata == "" THEN CONTINUE ; No keyword defined, try next file.
- ;debug(0)
- Ffound=1
- ;WEH file located. See if WEH file contains search hints.
- Helpfile2=IniReadPvt("LOOKUP","Located","",Wehfile)
- IF !FileExist(Helpfile2)
-
- Helpfile2=Helpfilei ; Then test actual ini setting.
- IF !FileExist(Helpfile2)
- Ffound=0
- WHILE 1
- IF WinMetrics(-2)==2 ; 32 bit platform.
- Hintname=IniReadPvt("LOOKUP","ALTLONG","",Wehfile)
- Hintreg=IniReadPvt("LOOKUP","REG32","",Wehfile)
- IF Hintname!="" THEN GOSUB HLPSRCH
- IF Ffound==1 THEN BREAK
-
- Hintname=IniReadPvt("LOOKUP","ALTSHORT","",Wehfile)
- IF Hintname!="" THEN GOSUB HLPSRCH
- IF Ffound==1 THEN BREAK
- ENDIF
-
- Hintname=IniReadPvt("LOOKUP","ALTSHORT","",Wehfile)
- Hintreg=IniReadPvt("LOOKUP","REG16","",Wehfile)
- IF Hintname!="" THEN GOSUB HLPSRCH
- IF Ffound==1 THEN BREAK
- Hintname=StrCat(FileRoot(Helpfilei),'.',FileExtension(Helpfilei))
- Hintreg=""
- GOSUB HLPSRCH
- BREAK
- ENDWHILE ; Random searching.
- IF Ffound==0
- ; Give up and ask user....what a concept...
- WHILE 1
- Helpfile2=Helpfile ; Ask user.
- Cancelcmd="goto HELPCAN23"
- Helpfile2=AskFileName("Please locate %HelpFile%","","Help Files (*.HLP)|*.HLP|",Helpfile2,1)
- Cancelcmd="exit"
- ; Verify we can access help file user entered
- IF FileExist(Helpfile2)
- Ffound=1
- BREAK
- ENDIF
-
- ; If cancelled, remove reference to help file from WSHELP.INI
- :HELPCAN23
- A=AskYesNo(Helpfile2,"Do you wish to remove %HelpFile% from the help file search?")
- IF A==@Yes THEN IniWritePvt(Helpsec,"HF%HFnum%","",Inifile)
- BREAK
-
- ENDWHILE ; Asking user.
- ENDIF ; Asking user.
- ENDIF ; Raw ini setting.
- IniWritePvt("LOOKUP","Located",Helpfile2,Wehfile) ; Save in weh file for next time.
- ENDIF ; File not located in weh hint.
-
-
- IF Ffound==0 THEN CONTINUE
- BREAK ; Done. break out of next file for loop.
- NEXT ; Next HFx for loop.
- IF Ffound==1
- SWITCH Wehtype
-
- CASE 1
- Wehdata=StrReplace(Wehdata,"~",StrCat(Num2Char(13),Num2Char(10)))
- Message(Helpword,Wehdata)
- BREAK
-
- CASE 2
- WinHelp(Helpfile2,"PARTIALKEY",Helpword)
- BREAK
-
- CASE 3
-
- ErrorMode(@Off)
- RunZoom(Helpfile2,Helpword)
- ErrorMode(@Cancel)
- IF LastError()==1902 THEN Message("WinBatch Studio Help Error","Help for >%helpword%< not available.")
- BREAK
-
- CASE 100
- ; Put your HelpFileType 100 stuff here
- Message("WinBatch Studio User Help - %HelpFile2%","Help for %helpword% goes here")
- BREAK
- END SWITCH
- ENDIF
- ENDIF ; From initial check for cusror on word.
- :KWHDONE
- ; Drop variables to save memory space
- DROP(Helpword,Wedir,Inifile,Filext,Helpsec,Hintdir,Hintname,Ffound)
- DROP(Wehinfo,Helpfilei,Wehfile,Wehtype,Wehdata,Helpfile,Helpfile2)
-
- EXIT
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- :HLPSRCH
- Hintdir=""
- ErrorMode(@Off)
- IF Hintreg!="" THEN Hintdir=RegQueryValue(@regMachine,Hintreg)
- ErrorMode(@Cancel)
- IF Hintdir==0 THEN Hintdir=""
- Helpfile2= StrCat(Hintdir,Hintname)
- IF !FileExist(Helpfile2)
- ; First of all, completely ignore path to help file specified and
- ; look in help directory FIRST!
- Helpfile=Hintname
- Helpfile2=StrCat(DirHome(),"HELP\%HelpFile%") ; Look in HELP dir first.
- IF !FileExist(Helpfile2)
- ; Remove directory, and let Windows search path
- Helpfile2=Helpfile ; Try local dir and path.
- IF !FileExist(Helpfile2)
- ; Check editor home dir just in case path search bypassed it
- Helpfile2="%WEDir%%HelpFile%" ; Check editor dir.
- IF !FileExist(Helpfile2) THEN RETURN
- ENDIF
- ENDIF
- ENDIF
- Ffound=1
- RETURN
-
-
-
-
-
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- EXIT ; Put an exit here in case anyone ever drops through to cancel.
- ; Not that we would ever do anything like that ourselves...
- :CANCEL
- %cancelcmd%
-