home *** CD-ROM | disk | FTP | other *** search
- ; This is a common WIL script file for the editor. It is used by both the
- ; utility menu in the Professional version and also for some internal
- ; editor functions...like looking up keyword help on a mouse click.
-
- CancelCmd="exit"
- W9876A=WinExeName("")
- W9876A=FileRoot(W9876A)
- goto %param1%
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- :BUTTONMACRO
- ; we get here via a line like
- ; Call("WWWEDIT.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.
-
- CancelCmd="goto KWHDONE" ; Setup cancel processing - clear variables
- HelpWord = wEdGetWord() ; Get Selected word
- if HelpWord=="" then Message("%W9876A% Help Error","Cursor must be on a word to use this function.")
- then Goto KWHDONE
-
-
-
-
- ; Locate our WEHELP.INI file and determine help file list to process
- WEDir = DirHome()
- inifile = StrCat(WEDir, "HELP\WEHELP.INI")
- if FileExist(inifile)==@FALSE then inifile=FileLocate("WEHELP.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,
-
- :KWHNEXTFILE
- HFnum = HFnum + 1
- wehinfo = StrUpper(IniReadPvt(helpsec, "HF%HFnum%", "NONE", inifile))
- If wehinfo == "NONE" Then Message("%W9876A% Help Error - %helpword%", "No applicable help files found.")
- Then Goto KWHDONE
- if wehinfo == "" then goto KWHNEXTFILE ; Empty HFx setting, skip
-
- ; Extract and build information from the HFx setting
- ;debug(1)
- HelpFileI=ItemExtract(1,wehinfo," ")
- wehfile = StrCat(WEDir, "HELP\",FileRoot(HelpFileI), ".WEH")
- if FileExist(wehfile)==@FALSE then wehfile=FileLocate(StrCat(FileRoot(HelpFileI),".WEH"))
- wehtype=strtrim(strsub(wehinfo,strlen(HelpFileI)+2,strlen(wehinfo)-strlen(HelpFileI)-1))
-
- ; Make sure we have a WEH file in the editor Help directory
-
- If !(FileExist(wehfile)) Then Message("WEHELP.INI Error", "%wehfile% not found")
- Then Goto KWHDONE
-
- ; Read Keyword data from WEH file
- wehdata=IniReadPvt("KEYWORDS",helpword,"",wehfile)
- If wehdata == "" Then Goto KWHNEXTFILE ; No keyword defined, try next file.
- ;debug(0)
-
- ; First of all, completely ignore path to help file specified and
- ; look in %W9876A% help directory FIRST!
-
- HelpFile=strcat(FileRoot(HelpFileI),'.',FileExtension(HelpFileI))
- HelpFile2="%WEDir%HELP\%HelpFile%" ;look in HELP dir first
- if FileExist(HelpFile2) then goto KWHDOIT
-
- ; Secondly, if that fails, try (suprise) actual INI file setting.
-
- HelpFile2=HelpFileI ; then test actual ini setting
- if FileExist(HelpFile2) then goto KWHDOIT
-
- ; Remove directory, and let Windows search path
- HelpFile2=HelpFile ; try local dir and path
- if FileExist(HelpFile2) then goto KWHDOIT
-
- ; See where !%$@# user installed editor and try there. (With \Help)
- HelpFile2=IniReadPvt("WWWSetup","%W9876A%","","WWW-PROD.INI")
- HelpFile2="%HelpFile2%\HELP\%HelpFile%" ; check setup help dir
- if FileExist(HelpFile2) then goto KWHDOIT
-
- ; See where !%$@# user installed editor and try there. (WithOut \Help)
- HelpFile2=IniReadPvt("WWWSetup","%W9876A%","","WWW-PROD.INI")
- HelpFile2="%HelpFile2%\%HelpFile%" ; check setup main dir
- if FileExist(HelpFile2) then goto KWHDOIT
-
- ; Check editor home dir just in case path search bypassed it
- HelpFile2="%WEDir%%HelpFile%" ; check editor dir
- if FileExist(HelpFile2) then goto KWHDOIT
-
- ; Give up and ask user....what a concept...
-
- :KWHHELPASK
- HelpFile2=HelpFile ; ask user
- CancelCmd="goto HELPCAN23"
- HelpFile2=AskFileName("Please locate %HelpFile%","","Help Files (*.HLP)|*.HLP|",HelpFile2,1)
- CancelCmd="exit"
- goto HELPCAN24
- ; HelpFile2=AskLine("Cannot locate %HelpFile2%","Please enter full path to %HelpFile% or empty line to ignore this file.",HelpFile2)
-
- ; If cancelled, remove reference to help file from WEHELP.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)
- then goto KWHNEXTFILE
-
- :HELPCAN24
- ; Verify we can access help file user entered
- if !FileExist(HelpFile2) then goto KWHHELPASK
-
- ; Hey its there!. Save info in WEHELP.INI file
- IniWritePvt(helpsec,"HF%HFnum%",strcat(HelpFile2," ",wehtype),inifile)
-
- ; Look a case statement!!!
- :KWHDOIT
- goto KWHTYPE%wehtype%
-
- :KWHTYPE1
- wehdata=strreplace(wehdata,"~",strcat(num2char(13),num2char(10)))
- Message(helpword,wehdata)
- goto KWHDONE
-
- :KWHTYPE2
- WinHelp(HelpFile2,"PARTIALKEY",helpword)
- goto KWHDONE
-
- :KWHTYPE3
-
- ErrorMode(@OFF)
- RunZoom(HelpFile2,helpword)
- ErrorMode(@CANCEL)
- if LastError()==1902 then Message("%W9876A% Help Error","Help for >%helpword%< not available.")
- goto KWHDONE
-
- :KWHTYPE100
- ; Put your HelpFileType 100 stuff here
- Message("%W9876A% User Help - %HelpFile2%","Help for %helpword% goes here")
- goto KWHDONE
-
-
-
- :KWHDONE
- ; Drop variables to save memory space
- Drop(HelpWord,WEDir,inifile,filext,helpsec,HFnum)
- Drop(wehinfo,HelpFileI,wehfile,wehtype,wehdata,HelpFile,HelpFile2)
-
- Exit
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- 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%
-