home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
High Voltage Shareware
/
high1.zip
/
high1
/
DIR8
/
WE_30C.ZIP
/
WWWEDIT.DL_
< prev
next >
Wrap
Text File
|
1992-12-12
|
6KB
|
150 lines
; This is a common WIL script file for WinEdit. It is used by both the
; utility menu in the Professional version and also for some internal
; WinEdit functions...like looking up keyword help on a mouse click.
CancelCmd="exit"
goto %param1%
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
:BUTTONMACRO
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("WinEdit 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("WinEdit 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 WinEdit 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 WinEdit 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 WinEdit and try there. (With \Help)
HelpFile2=IniReadPvt("WWWSetup","WinEdit","","WWW-PROD.INI")
HelpFile2="%HelpFile2%\HELP\%HelpFile%" ; check setup help dir
if FileExist(HelpFile2) then goto KWHDOIT
; See where !%$@# user installed WinEdit and try there. (WithOut \Help)
HelpFile2=IniReadPvt("WWWSetup","WinEdit","","WWW-PROD.INI")
HelpFile2="%HelpFile2%\%HelpFile%" ; check setup main dir
if FileExist(HelpFile2) then goto KWHDOIT
; Check WinEdit home dir just in case path search bypassed it
HelpFile2="%WEDir%%HelpFile%" ; check winedit dir
if FileExist(HelpFile2) then goto KWHDOIT
; Give up and ask user....what a concept...
:KWHHELPASK
HelpFile2=HelpFile ; ask user
HelpFile2=AskLine("Cannot locate %HelpFile2%","Please enter full path to %HelpFile% or empty line to ignore this file.",HelpFile2)
; If empty line entered, remove reference to help file from WEHELP.INI
if HelpFile2=="" then IniWritePvt(helpsec,"HF%HFnum%","",inifile)
then goto KWHNEXTFILE
; 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("WinEdit Help Error","Help for >%helpword%< not available.")
goto KWHDONE
:KWHTYPE100
; Put your HelpFileType 100 stuff here
Message("WinEdit 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%