home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2000 April
/
PCWorld_2000-04_cd.bin
/
Software
/
TemaCD
/
winedit
/
wwwedit.dl_
< prev
next >
Wrap
Text File
|
1999-10-07
|
7KB
|
191 lines
; 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"
goto %param1%
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
:BUTTONMACRO
; we get here via a line like
; Call(strcat(DirHome(),"SYSTEM\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.
;debug(1)
CancelCmd="goto KWHDONE" ; Setup cancel processing - clear variables
HelpWord = wEdGetWord() ; Get Selected word
if HelpWord==""
Message("WinEdit Help Error","Cursor must be on a word to use this function.")
else
; Locate our WEHELP.INI file and determine help file list to process
WEDir = DirHome()
inifile = StrCat(WEDir, "HELP\LOOKUP\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,
for HFNUM=1 to 1000
ffound=0
wehinfo = StrUpper(IniReadPvt(helpsec, "HF%HFnum%", "NONE", inifile))
If wehinfo == "NONE"
Message("WinEdit 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\LOOKUP\",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 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)
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("WinEdit Help Error","Help for >%helpword%< not available.")
break
case 100
; Put your HelpFileType 100 stuff here
Message("WinEdit 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,HFnumhintreg,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%