home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / w / wed20g.zip / WWWEDIT.DL_ < prev    next >
Text File  |  1992-11-30  |  6KB  |  148 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.     filext = FileExtension(wGetFileName())
  31.     If filext == "" Then filext = "NONE"   ; section for files w/no extension
  32.     helpsec = IniReadPvt("EXTENSIONS", filext, "DEFAULT", inifile)
  33.     HFnum = 0
  34.  
  35.  
  36.  
  37.  
  38. ; Get the next help file from the list,
  39.  
  40. :KWHNEXTFILE
  41.     HFnum = HFnum + 1
  42.     wehinfo = StrUpper(IniReadPvt(helpsec, "HF%HFnum%", "NONE", inifile))
  43.     If wehinfo == "NONE" Then Message("WinEdit Help Error - %helpword%", "No applicable help files found.")
  44.                          Then Goto KWHDONE
  45.     if wehinfo == "" then goto KWHNEXTFILE     ; Empty HFx setting, skip
  46.  
  47. ; Extract and build information from the HFx setting
  48.     ;debug(1)
  49.     HelpFileI=ItemExtract(1,wehinfo," ")
  50.     wehfile = StrCat(WEDir, "HELP\",FileRoot(HelpFileI), ".WEH")
  51.     wehtype=strtrim(strsub(wehinfo,strlen(HelpFileI)+2,strlen(wehinfo)-strlen(HelpFileI)-1))
  52.  
  53. ; Make sure we have a WEH file in the WinEdit Help directory
  54.  
  55.     If !(FileExist(wehfile)) Then Message("WEHELP.INI Error", "%wehfile% not found")
  56.                              Then Goto KWHDONE
  57.  
  58. ; Read Keyword data from WEH file
  59.     wehdata=IniReadPvt("KEYWORDS",helpword,"",wehfile)
  60.     If wehdata == "" Then Goto KWHNEXTFILE    ; No keyword defined, try next file.
  61.     ;debug(0)
  62.  
  63. ; First of all, completely ignore path to help file specified and
  64. ; look in WinEdit help directory FIRST!
  65.  
  66.         HelpFile=strcat(FileRoot(HelpFileI),'.',FileExtension(HelpFileI))
  67.         HelpFile2="%WEDir%HELP\%HelpFile%"         ;look in HELP dir first
  68.         if FileExist(HelpFile2) then goto KWHDOIT
  69.  
  70. ; Secondly, if that fails, try (suprise) actual INI file setting.
  71.  
  72.         HelpFile2=HelpFileI      ; then test actual ini setting
  73.         if FileExist(HelpFile2) then goto KWHDOIT
  74.  
  75. ; Remove directory, and let Windows search path
  76.         HelpFile2=HelpFile                         ; try local dir and path
  77.         if FileExist(HelpFile2) then goto KWHDOIT
  78.  
  79. ; See where !%$@# user installed WinEdit and try there. (With \Help)
  80.         HelpFile2=IniReadPvt("WWWSetup","WinEdit","","WWW-PROD.INI")
  81.         HelpFile2="%HelpFile2%\HELP\%HelpFile%"    ; check setup help dir
  82.         if FileExist(HelpFile2) then goto KWHDOIT
  83.  
  84. ; See where !%$@# user installed WinEdit and try there. (WithOut \Help)
  85.         HelpFile2=IniReadPvt("WWWSetup","WinEdit","","WWW-PROD.INI")
  86.         HelpFile2="%HelpFile2%\%HelpFile%"        ; check setup main dir
  87.         if FileExist(HelpFile2) then goto KWHDOIT
  88.  
  89. ; Check WinEdit home dir just incase path search bypassed it
  90.         HelpFile2="%WEDir%%HelpFile%"            ; check winedit dir
  91.         if FileExist(HelpFile2) then goto KWHDOIT
  92.  
  93. ; Give up and ask user....what a concept...
  94.  
  95.         :KWHHELPASK
  96.         HelpFile2=HelpFile                        ; ask user
  97.         HelpFile2=AskLine("Cannot locate %HelpFile2%","Please enter full path to %HelpFile% or empty line to ignore this file.",HelpFile2)
  98.  
  99. ; If empty line entered, remove reference to help file from WEHELP.INI
  100.         if HelpFile2=="" then IniWritePvt(helpsec,"HF%HFnum%","",inifile)
  101.                          then goto KWHNEXTFILE
  102.  
  103. ; Verify we can access help file user entered
  104.         if !FileExist(HelpFile2) then goto KWHHELPASK
  105.  
  106. ; Hey its there!.  Save info in WEHELP.INI file
  107.         IniWritePvt(helpsec,"HF%HFnum%",strcat(HelpFile2," ",wehtype),inifile)
  108.  
  109.         ; Look a case statement!!!
  110. :KWHDOIT
  111.         goto KWHTYPE%wehtype%
  112.  
  113.         :KWHTYPE1
  114.               wehdata=strreplace(wehdata,"~",strcat(num2char(13),num2char(10)))
  115.               Message(helpword,wehdata)
  116.               goto KWHDONE
  117.  
  118.         :KWHTYPE2
  119.               WinHelp(HelpFile2,"KEY",helpword)
  120.               goto KWHDONE
  121.  
  122.         :KWHTYPE3
  123.  
  124.               ErrorMode(@OFF)
  125.               RunZoom(HelpFile2,helpword)
  126.               ErrorMode(@CANCEL)
  127.               if LastError()==1902 then Message("WinEdit Help Error","Help for >%helpword%< not available.")
  128.               goto KWHDONE
  129.  
  130.         :KWHTYPE100
  131.            ; Put your HelpFileType 100 stuff here
  132.               Message("WinEdit User Help - %HelpFile2%","Help for %helpword% goes here")
  133.               goto KWHDONE
  134.  
  135.  
  136.          
  137. :KWHDONE
  138. ; Drop variables to save memory space
  139.         Drop(HelpWord,WEDir,inifile,filext,helpsec,HFnum)
  140.         Drop(wehinfo,HelpFileI,wehfile,wehtype,wehdata,HelpFile,HelpFile2)
  141.  
  142.         Exit
  143. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  144. Exit      ; Put an exit here in case anyone ever drops through to cancel
  145.           ; Not that we would ever do anything like that ourselves...
  146. :CANCEL
  147.        %CancelCmd%
  148.