home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / w / we-20k.zip / WWWEDIT.DL_ < prev    next >
Text File  |  1992-12-12  |  6KB  |  150 lines

  1. ; This is a common WIL script file for WinEdit.  It is used by both the
  2. ; utility menu in the Professional version and also for some internal
  3. ; WinEdit functions...like looking up keyword help on a mouse click.
  4.  
  5.       CancelCmd="exit"
  6.       goto %param1%
  7.  
  8. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  9. :BUTTONMACRO
  10.         Message("Sample Macro","You called user macro number %param2%")
  11.         exit
  12.  
  13.  
  14. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  15. :KEYWORDHELP
  16.  
  17. ;First do some initialization and grab the word help is desired for.
  18.  
  19.     CancelCmd="goto KWHDONE"      ; Setup cancel processing - clear variables
  20.     HelpWord = wEdGetWord()         ; Get Selected word
  21.     if HelpWord=="" then Message("WinEdit Help Error","Cursor must be on a word to use this function.")
  22.                     then Goto KWHDONE
  23.  
  24.  
  25.  
  26.  
  27. ; Locate our WEHELP.INI file and determine help file list to process
  28.     WEDir = DirHome()
  29.     inifile = StrCat(WEDir, "HELP\WEHELP.INI")
  30.     if FileExist(inifile)==@FALSE then inifile=FileLocate("WEHELP.INI")
  31.     filext = FileExtension(wGetFileName())
  32.     If filext == "" Then filext = "NONE"   ; section for files w/no extension
  33.     helpsec = IniReadPvt("EXTENSIONS", filext, "DEFAULT", inifile)
  34.     HFnum = 0
  35.  
  36.  
  37.  
  38.  
  39. ; Get the next help file from the list,
  40.  
  41. :KWHNEXTFILE
  42.     HFnum = HFnum + 1
  43.     wehinfo = StrUpper(IniReadPvt(helpsec, "HF%HFnum%", "NONE", inifile))
  44.     If wehinfo == "NONE" Then Message("WinEdit Help Error - %helpword%", "No applicable help files found.")
  45.                          Then Goto KWHDONE
  46.     if wehinfo == "" then goto KWHNEXTFILE     ; Empty HFx setting, skip
  47.  
  48. ; Extract and build information from the HFx setting
  49.     ;debug(1)
  50.     HelpFileI=ItemExtract(1,wehinfo," ")
  51.     wehfile = StrCat(WEDir, "HELP\",FileRoot(HelpFileI), ".WEH")
  52.     if FileExist(wehfile)==@FALSE then wehfile=FileLocate(StrCat(FileRoot(HelpFileI),".WEH"))
  53.     wehtype=strtrim(strsub(wehinfo,strlen(HelpFileI)+2,strlen(wehinfo)-strlen(HelpFileI)-1))
  54.  
  55. ; Make sure we have a WEH file in the WinEdit Help directory
  56.  
  57.     If !(FileExist(wehfile)) Then Message("WEHELP.INI Error", "%wehfile% not found")
  58.                              Then Goto KWHDONE
  59.  
  60. ; Read Keyword data from WEH file
  61.     wehdata=IniReadPvt("KEYWORDS",helpword,"",wehfile)
  62.     If wehdata == "" Then Goto KWHNEXTFILE    ; No keyword defined, try next file.
  63.     ;debug(0)
  64.  
  65. ; First of all, completely ignore path to help file specified and
  66. ; look in WinEdit help directory FIRST!
  67.  
  68.         HelpFile=strcat(FileRoot(HelpFileI),'.',FileExtension(HelpFileI))
  69.         HelpFile2="%WEDir%HELP\%HelpFile%"         ;look in HELP dir first
  70.         if FileExist(HelpFile2) then goto KWHDOIT
  71.  
  72. ; Secondly, if that fails, try (suprise) actual INI file setting.
  73.  
  74.         HelpFile2=HelpFileI      ; then test actual ini setting
  75.         if FileExist(HelpFile2) then goto KWHDOIT
  76.  
  77. ; Remove directory, and let Windows search path
  78.         HelpFile2=HelpFile                         ; try local dir and path
  79.         if FileExist(HelpFile2) then goto KWHDOIT
  80.  
  81. ; See where !%$@# user installed WinEdit and try there. (With \Help)
  82.         HelpFile2=IniReadPvt("WWWSetup","WinEdit","","WWW-PROD.INI")
  83.         HelpFile2="%HelpFile2%\HELP\%HelpFile%"    ; check setup help dir
  84.         if FileExist(HelpFile2) then goto KWHDOIT
  85.  
  86. ; See where !%$@# user installed WinEdit and try there. (WithOut \Help)
  87.         HelpFile2=IniReadPvt("WWWSetup","WinEdit","","WWW-PROD.INI")
  88.         HelpFile2="%HelpFile2%\%HelpFile%"        ; check setup main dir
  89.         if FileExist(HelpFile2) then goto KWHDOIT
  90.  
  91. ; Check WinEdit home dir just in case path search bypassed it
  92.         HelpFile2="%WEDir%%HelpFile%"            ; check winedit dir
  93.         if FileExist(HelpFile2) then goto KWHDOIT
  94.  
  95. ; Give up and ask user....what a concept...
  96.  
  97.         :KWHHELPASK
  98.         HelpFile2=HelpFile                        ; ask user
  99.         HelpFile2=AskLine("Cannot locate %HelpFile2%","Please enter full path to %HelpFile% or empty line to ignore this file.",HelpFile2)
  100.  
  101. ; If empty line entered, remove reference to help file from WEHELP.INI
  102.         if HelpFile2=="" then IniWritePvt(helpsec,"HF%HFnum%","",inifile)
  103.                          then goto KWHNEXTFILE
  104.  
  105. ; Verify we can access help file user entered
  106.         if !FileExist(HelpFile2) then goto KWHHELPASK
  107.  
  108. ; Hey its there!.  Save info in WEHELP.INI file
  109.         IniWritePvt(helpsec,"HF%HFnum%",strcat(HelpFile2," ",wehtype),inifile)
  110.  
  111.         ; Look a case statement!!!
  112. :KWHDOIT
  113.         goto KWHTYPE%wehtype%
  114.  
  115.         :KWHTYPE1
  116.               wehdata=strreplace(wehdata,"~",strcat(num2char(13),num2char(10)))
  117.               Message(helpword,wehdata)
  118.               goto KWHDONE
  119.  
  120.         :KWHTYPE2
  121.               WinHelp(HelpFile2,"PARTIALKEY",helpword)
  122.               goto KWHDONE
  123.  
  124.         :KWHTYPE3
  125.  
  126.               ErrorMode(@OFF)
  127.               RunZoom(HelpFile2,helpword)
  128.               ErrorMode(@CANCEL)
  129.               if LastError()==1902 then Message("WinEdit Help Error","Help for >%helpword%< not available.")
  130.               goto KWHDONE
  131.  
  132.         :KWHTYPE100
  133.            ; Put your HelpFileType 100 stuff here
  134.               Message("WinEdit User Help - %HelpFile2%","Help for %helpword% goes here")
  135.               goto KWHDONE
  136.  
  137.  
  138.          
  139. :KWHDONE
  140. ; Drop variables to save memory space
  141.         Drop(HelpWord,WEDir,inifile,filext,helpsec,HFnum)
  142.         Drop(wehinfo,HelpFileI,wehfile,wehtype,wehdata,HelpFile,HelpFile2)
  143.  
  144.         Exit
  145. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  146. Exit      ; Put an exit here in case anyone ever drops through to cancel
  147.           ; Not that we would ever do anything like that ourselves...
  148. :CANCEL
  149.        %CancelCmd%
  150.