home *** CD-ROM | disk | FTP | other *** search
- ;*** HINTS.WAS v1.00 - Helpful Hints script for PW2.0 ***
-
- ;*****************************************************************************
- ;* *
- ;* HINTS.WAS *
- ;* Copyright (C) 1994 DATASTORM Technologies, Inc. *
- ;* All rights reserved. *
- ;* *
- ;* This program displays helpful hints and tips about PROCOMM PLUS for *
- ;* Windows from a file called HINTS.TXT. These hints can be displayed *
- ;* at startup of PW2 or can be scrolled through sequentially. If "Display *
- ;* at Startup" is checked, STARTUP.WAX will launch HINTS.WAX. HINTS.TXT *
- ;* can be modified to display any text desired. *
- ;* *
- ;* This ASPECT SCRIPT is intended only as a sample of ASPECT programming. *
- ;* DATASTORM makes no warranty of any kind, express or implied, including *
- ;* without limitation, any warranties of merchantability and/or fitness *
- ;* for a particular purpose. Use of this program is at your own risk. *
- ;* *
- ;*****************************************************************************
-
-
- ;*****************************************************************************
- ;* CONSTANTS *
- ;*****************************************************************************
-
- #define szHEADER1 "; startup.was - main startup script"
- #define szHEADER2 "; startup.was - created by hints.wa"
- #define HINTS_TXT "HINTS.TXT" ; name of hints text file
- #define HINTS_INI "HINTS.INI" ; name of hints.ini file
- #define ICON_FILE "NPW.DLL"
- #define PW_INI "PW2.INI" ; name of PW2.ini file
- #define STARTUP_SOURCE "STARTUP.WAS" ; name of startup source script
- #define STARTUP_SCRIPT "STARTUP.WAX" ; name of startup compiled script
- #define STARTUP_BACKUP "STARTUP.WA$" ; name of renamed startup source
-
- ;*****************************************************************************
- ; GLOBAL VARIABLES *
- ;*****************************************************************************
-
- long lHintsTextOffset ; offset to hints text for display
- long lHintsTextLength ; length of hints text for display
-
- integer giHintCount ; hint index counter
- integer bHintsEnable ; hints enable/disable value
- integer giHintNumber ; number of current hint
- integer giHelpIndex ; help topic index for current hint
- integer giLastHint ; number of last hint in hints.txt
- integer giIconHeaderIndex
- integer bStartUp = 1
-
- string szHintsTxt ; full filename for hints text file
- string szHintsIni ; full filename for hints .ini file
- string szPWIni ; full filename for PW .ini file
- string szDialogHeader ; category header for dialog box
- string szHintID ; hint number string for dialog box
- string szIconFileName ; icon filename for category header
- string szIconDefaultFile ; default name for header icon file
-
- ;*****************************************************************************
- ;* *
- ;* MAIN *
- ;* *
- ;* The main procedure calls the appropriate procedures that initialize and *
- ;* fetch the information needed throughout the program loop. *
- ;* *
- ;* Calls: SetPaths, OpenINI, GetHint, DrawDialog, CenterIcon *
- ;* *
- ;* Modifies globals: None *
- ;* *
- ;*****************************************************************************
-
- proc Main
- SetPaths() ; add paths to filenames
- OpenINI() ; open HINTS.INI
- GetHint() ; get the next hint
- DrawDialog() ; draw the main dialog box
- CenterIcon() ; center the header icon
- HelpEnable() ; enable/disable help button
- when dialog 0 call ProcessDialogEvent
- when USEREXIT call ExitProgram ; if user exits via esc, close etc.
- while 1
- yield
- endwhile
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* SETPATHS *
- ;* *
- ;* This procedure stores the filename constants with their correct paths. *
- ;* *
- ;* Called by: Main *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: szHintsTxt, szHisntIni, szIconHeaderName, szPwIni *
- ;* *
- ;*****************************************************************************
-
- proc SetPaths
- szHintsTxt = $ASPECTPATH
- szHintsIni = $ASPECTPATH
- szPWIni = $WINPATH
- szIconDefaultFile = $PWLOCALPATH
-
- addfilename szHintsTxt HINTS_TXT ; add aspect path to HINTS.TXT
- addfilename szHintsIni HINTS_INI ; add aspect path to HINTS.INI
- addfilename szPWIni PW_INI ; add Windows path toe PW2.INI
- addfilename szIconDefaultFile ICON_FILE ; add PW path to NPW.DLL
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* OPENINI *
- ;* *
- ;* This procedure tests for the existence of HINTS.TXT and HINTS.INI. It *
- ;* also determines if the size of HINTS.TXT has changed since HINTS.INI has *
- ;* been created. If HINTS.INI does not exist or the size of HINTS.TXT has *
- ;* changed a new HINTS.INI is created. *
- ;* *
- ;* Called by: Main *
- ;* *
- ;* Calls: CreateINI, CheckTXTSize *
- ;* *
- ;* Modifies globals: bHintsEnable *
- ;* *
- ;*****************************************************************************
-
- proc OpenINI
- isfile szPWIni ; does PW2.INI exist
- if success ; if yes read the hints enable flag
- profilerd szPWini "startup script" "Run Hints" bHintsEnable
- else ; if no set hints enable flag OFF
- bHintsEnable = 0
- endif
-
- isfile szHintsTxt ; does HINTS.TXT exist
- if failure ; if no display errormsg and exit
- errormsg "Hints file could not be found"
- exit
- endif
-
- isfile szHintsIni ; does HINTS.INI exist
- if failure ; if no create it
- CreateINI()
- else ; if yes has HINTS.TXT changed?
- CheckTXTSize()
- endif
-
- profilerd szHintsIni "CONFIG" "LastHint" giLastHint ; read last hint info
-
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* HELPENABLE *
- ;* *
- ;* This procedure enables or disables the MORE pushbutton depending upon *
- ;* whether or not a Help Index exists for the current hint. *
- ;* *
- ;* Called by: Main, GetHint *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: None *
- ;* *
- ;*****************************************************************************
-
- proc HelpEnable
-
- if giHelpIndex == 0 ; no help index, disable MORE button
- disable DLGCTRL 0 11
- else ; help index exists, enable button
- enable DLGCTRL 0 11
- endif
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* CREATEINI *
- ;* *
- ;* This procedure creates HINTS.INI based upon the information in HINTS.TXT. *
- ;* HINTS.INI contains the offset, length, category and other information *
- ;* needed by HINTS.WAX. *
- ;* *
- ;* Called by: OpenINI, CheckTXTSize *
- ;* *
- ;* Calls: DrawWaitingDialog, ReadCategories, ReadHints, CreateIniConfig *
- ;* *
- ;* Modifies globals: None *
- ;* *
- ;*****************************************************************************
-
- proc CreateINI
-
- DrawWaitingDialog() ; draw the waiting dialog box
-
- fopen 0 szHintsTxt READ TEXT ; open HINTS.TXT
- fopen 1 szHintsIni CREATE TEXT ; create HINTS.INI
- fputs 1 ";Hints.INI file for PW2 Hints Script - Do not modify!"
- fclose 1 ; write header to HINTS.INI, close
-
- ReadIconFiles()
-
- ReadCategories() ; read Category List from HINTS.TXT
-
- ReadHints() ; read hints text from HINTS.TXT
-
- CreateIniConfig() ; create CONFIG info in HINTS.INI
-
- fclose 0 ; close HINTS.TXT
-
- dlgdestroy 1 OK ; destroy the waiting dialog box
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* READICONFILES *
- ;* *
- ;* This procedure reads the icon file name information from HINTS.TXT and *
- ;* creates INI entries in HINTS.INI based upon this information. *
- ;* *
- ;* Called by: CreateIni *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: None *
- ;* *
- ;*****************************************************************************
-
- proc ReadIconFiles
- integer bEndOfFile, iIconIndex, iIconLength
- string szIconName, szIconFile, szNextLine
-
- fgets 0 szNextLine ; get next line of HINTS.TXT
- FEOF 0 bEndOfFile ; test for end of file condition
-
- while !bEndOfFile ; loop while not at end of file
- strfind szNextLine "[Icon Files]" ; is line Icon File Header?
- if success ; if yes,
- exitwhile ; exit the loop
- endif
-
- strfind szNextLine "[Category List]" ; Is line Category List Header?
- if success ; if yes,
- return ; return to CreateIni
- endif
-
- strfind szNextLine "[Hints Text]" ; is line Hints Text header?
- if success ; if yes,
- errormsg "error in HINTS.TXT - no [Category List] ... see HINTS.DOC\
- (available from the DATASTORM BBS)"
- exit ; display error message, exit
- endif
- fgets 0 szNextLine ; get next line of HINTS.TXT
- FEOF 0 bEndOfFile ; test end of file condition
- endwhile
-
- if bEndOfFile
- errormsg "error in HINTS.TXT - no Headers detected ... see HINTS.DOC\
- (available from the DATASTORM BBS)"
- exit
- endif
-
- fgets 0 szNextLine ; get next line of HINTS.TXT
- FEOF 0 bEndOfFile ; test end of file condition
-
- while !bEndOfFile ; loop while not at end of file
- strfind szNextLine "$_" iIconIndex ; is line Icon File Info?
- if success ;if yes,
- strextract szIconName szNextLine "=" 0 ; get icon reference name
- strextract szIconFile szNextLine "=" 1 ; get icon file name
- strlen szIconName iIconLength
- iIconIndex+=2
- iIconLength = iIconLength - iIconIndex
- substr szIconName szIconName iIconIndex iIconLength
-
- ; write icon info to HINTS.INI
-
- profilewr szHintsIni "Icon Files" szIconName szIconFile
- else ; if line isn't Icon Info
- strfind szNextLine "[Category List]" ; is it Category List header?
- if success ; if yes,
- return ; return to CreateIni
- endif
- endif
- fgets 0 szNextLine ; get next line of HINTS.INI
- FEOF 0 bEndOfFile ; test for end of file condition
- endwhile
-
- errormsg "error in HINTS.TXT - no [Category List] ... see HINTS.DOC\
- (available from the DATASTORM BBS)"
- delfile szHintsIni
- exit
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* READCATEGORIES *
- ;* *
- ;* This procedure reads the category list information from HINTS.TXT and *
- ;* creates INI entries in HINTS.INI based upon this information. *
- ;* *
- ;* Called by: CreateIni *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: None *
- ;* *
- ;*****************************************************************************
-
- proc ReadCategories
- string szNextline, szCategory, szIconIndex, szCatInfo, szHeader
- string szIconFileName
- integer bEndOfFile, iCatIndex, iCatLength
-
- fgets 0 szNextLine ; get next line of HINTS.TXT
- FEOF 0 bEndOfFile ; test for end of file condition
- while !bEndOfFile ; loop while not at end of file
- strfind szNextLine "$_" iCatIndex ; does line contain category info?
- if success ;if yes,
- strextract szCategory szNextLine "," 0 ; get hint category
- strextract szHeader szNextLine "," 1 ; get Header Phrase
- strextract szIconIndex szNextLine "," 2 ; get Icon index
- strextract szIconFileName szNextLine "," 3 ; get Icon file name
- strlen szCategory iCatLength ; prepare hint info for
- iCatIndex+=2 ; use in HINTS.INI
- iCatLength = iCatLength - iCatIndex
- substr szCategory szCategory iCatIndex iCatLength
-
- strcmp szIconFileName ""
- if failure ; if icon file name is null
- strfmt szCatInfo "%s,%s,%s" szHeader szIconIndex szIconFileName
- else ; otherwise
- strfmt szCatInfo "%s,%s" szHeader szIconIndex
- endif
-
- profilewr szHintsIni "Categories" szCategory szCatInfo
- else ; if not a category info line,
- strfind szNextLine "[Hints Text]"
- if success ; check for end of category marker
- return
- endif
- endif
- fgets 0 szNextLine ; get next line of HINTS.TXT
- FEOF 0 bEndOfFile ; test for end of file condition
- endwhile
-
- errormsg "Error in HINTS.TXT - no [Hints Text] ... see HINTS.DOC\
- (available from the DATASTORM BBS)"
- delfile szHintsIni
- exit
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* READHINTS *
- ;* *
- ;* This procedure reads the hints text information from HINTS.TXT and *
- ;* creates ini entries containing the hint offset, length and help index in *
- ;* HINTS.INI. *
- ;* *
- ;* Called by: CreateIni *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: giHintCount *
- ;* *
- ;*****************************************************************************
-
- proc ReadHints
- string szNextLine, szCategory
- integer bEndOfFile, iHintEnd, iHelpLength
- long lHintStart, lHelpPointer
-
-
- fgets 0 szNextLine ; get next line of HINTS.TXT
- FEOF 0 bEndOfFile ; test for end of file condition
- giHintCount = 1 ; set hint counter
-
- while !bEndOfFile ; loop while not at end of file
- strfind szNextLine "$_" ; does line contain hint category?
- if success ; if yes, get Category Name
- strextract szCategory szNextLine "_" 1
- ftell 0 lHintStart ; get offset of hint text
- endif
-
- strfind szNextLine "#_" i5 ; does line contain hint text?
- if success ; if yes,
- ftell 0 lHelpPointer ; get offset of help index
- strlen szNextLine iHelpLength ; get length of the help index line
- iHintEnd =lHelpPointer - iHelpLength ; figure end of hint offset
- atoi szNextLine giHelpIndex ; convert help index to an integer
- Write2Ini(lHintStart,iHintEnd,giHelpIndex,szCategory)
- giHintCount++ ; write HINTS.INI info and
- ; increment count
- endif
-
- fgets 0 szNextLine ; get next line of HINTS.TXT
- FEOF 0 bEndOfFile ; test for end of file condition
- endwhile
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* DRAWWAITINGDIALOG *
- ;* *
- ;* This procedures draws a dialog box displayed while the HINTS.INI file *
- ;* is created. *
- ;* *
- ;* Called by: CreateIni *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: None *
- ;* *
- ;*****************************************************************************
-
- proc DrawWaitingDialog
- dialogbox 1 97 89 125 38 7 "Helpful Hints"
- text 2 1 19 123 8 "Please wait ..." center
- text 1 0 8 124 8 "Preparing Hints" center
- enddialog
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* WRITE2INI *
- ;* *
- ;* This procedure writes the current hint information to HINTS.INI. *
- ;* *
- ;* Called by: CreateIni *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: None *
- ;* *
- ;*****************************************************************************
-
- proc Write2Ini
- param long lHintStart
- param integer iHintEnd, giHelpIndex
- param string szCategory
-
- integer iHintLength
- string szHintIniString, szHintLabel
-
- iHintLength = iHintEnd - lHintStart - 2
-
- strfmt szHintIniString "%i,%i,%i,%s" lHintStart iHintLength giHelpIndex \
- szCategory
- strfmt szHintLabel "Hint_%i" giHintCount
- profilewr szHintsIni "Hint Text" szHintLabel szHintIniString
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* CREATEINICONFIG *
- ;* *
- ;* This procedure writes the size of HINTS.TXT, next hint number and last *
- ;* hint number into a CONFIG section in HINTS.INI *
- ;* *
- ;* Called by: CreateIni *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: giHintCount *
- ;* *
- ;*****************************************************************************
-
- proc CreateIniConfig
- integer iTextFileSize
-
- fileget szHintsTxt SIZE l0 ; get size of HINTS.TXT
- iTextFileSize = l0 ; convert size to integer
- giHintCount-- ; update hint count
- profilewr szHintsIni "CONFIG" "TextFileSize" iTextFileSize
- profilewr szHintsIni "CONFIG" "NextHint" 1
- profilewr szHintsIni "CONFIG" "LastHint" giHintCount
-
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* CHECKTXTSIZE *
- ;* *
- ;* This procedure determines if the size of HINTS.TXT has changed since the *
- ;* HINTS.INI file was created. If it has, a new HINTS.INI is created. *
- ;* *
- ;* Called by: OpenIni *
- ;* *
- ;* Calls: CreateIni *
- ;* *
- ;* Modifies globals: None *
- ;* *
- ;*****************************************************************************
-
- proc CheckTXTSize
- integer iOldFileSize, iNewFileSize
- long lCurrentFileSize
-
- profilerd szHintsIni "CONFIG" "TextFileSize" iOldFileSize
- fileget szHintsTxt SIZE lCurrentFileSize ; get size of HINTS.TXT
- iNewFileSize = lCurrentFileSize ; compare current size to
- if iNewFileSize != iOldFileSize ; previous size - if not the
- CreateINI() ; same, create new HINTS.INI
- endif
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* GETHINT *
- ;* *
- ;* This procedure gets the information needed to display the next hint from *
- ;* HINTS.INI. *
- ;* *
- ;* Called by: Main, ProcessDialogEvent *
- ;* *
- ;* Calls: MakeDialogHeader, HelpEnable *
- ;* *
- ;* Modifies globals: giHintNumber, giHelpIndex, lHintsTextLength, *
- ;* lHintsTextOffset *
- ;* *
- ;*****************************************************************************
-
- proc GetHint
- string szHintIniString, szHintLabel, szCategory
-
- profilerd szHintsIni "CONFIG" "NextHint" giHintNumber ; get hint number
- strfmt szHintLabel "Hint_%i" giHintNumber
-
- profilerd szHintsIni "Hint Text" szHintLabel szHintIniString ; get info
-
- strextract s0 szHintIniString "," 0 ; extract hint offset
- strextract s1 szHintIniString "," 1 ; extract length
- strextract s2 szHintIniString "," 2 ; extract help index
- strextract szCategory szHintIniString "," 3 ; extract hint category
-
- atol s0 lHintsTextOffset ; convert hint offset to long value
- atol s1 lHintsTextLength ; convert hint length to long value
- atoi s2 giHelpIndex ; convert help index to an integer
-
- if lHintsTextLength < 0 ; if length has exceeded 32768,
- lHintsTextLength += 65536 ; convert to positive long value
- endif
-
- if lHintsTextOffset < 0 ; if offset has exceeded 32768,
- lHintsTextOffset += 65536 ; convert to positive long value
- endif
-
- MakeDialogHeader(szCategory) ; set header info based on category
-
- dlgupdate 0 4 6 ; update icon and header text
- dlgupdate 0 50 ; update hint text
- HelpEnable() ; enable/disable MORE button
-
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* MAKEDIALOGHEADER *
- ;* *
- ;* This procedure determines the header information to be displayed in the *
- ;* dialog box, based upon the category name of the current hint. A header *
- ;* phrase and the icon index for NPW.DLL are updated. *
- ;* *
- ;* Called by: GetHint *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: giIconHeaderIndex, szDialogHeader, szHintID *
- ;* *
- ;*****************************************************************************
-
- proc MakeDialogHeader
- param string szCategory
- string szCatInfo, szIconHeaderIndex, szIconFileReference
-
- profilerd szHintsIni "Categories" szCategory szCatInfo ; get category info
-
- strcmp szCatInfo "" ; if no category info,
- if success
- szCategory = "Default" ; set category to DEFAULT
- ; and read Default info
- profilerd szHintsIni "Categories" szCategory szCatInfo
- endif
-
- strextract szDialogHeader szCatInfo "," 0 ; get header phrase
- strextract szIconHeaderIndex szCatInfo "," 1 ; get header icon index
- strextract szIconFileReference szCatInfo "," 2 ; get icon reference name
-
- profilerd szHintsIni "Icon Files" szIconFileReference szIconFileName
-
- strcmp szIconFileName "" ; if icon reference is null,
- if success
- szIconFileName = szIconDefaultFile ; set icon file to default
- endif
-
- atoi szIconHeaderIndex giIconHeaderIndex ; convert index to integer
- strfmt szHintID "(%i)" giHintNumber ; format number string
-
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* PROCESSDIALOGEVENT *
- ;* *
- ;* This procedure determines what action to take based upon the dialog *
- ;* event. *
- ;* *
- ;* Called by: (when dialog) *
- ;* *
- ;* Calls: IncrementHint, DecrementHint, GetHint, ExitProgram *
- ;* *
- ;* Modifies globals: None *
- ;* *
- ;*****************************************************************************
-
- proc ProcessDialogEvent
- integer iEventID
-
- dlgevent 0 iEventID ; process the dialog event
- switch iEventID
- case -1 ; if ESCAPE or CLOSE or
- case 10 ; OK was clicked,
- ExitProgram() ; call procedure to exit script
- endcase
-
- case 11 ; if MORE was clicked,
- help TOPIC giHelpIndex ; display help info
- endcase
-
- case 12 ; if Previous was clicked,
- DecrementHint() ; decrement hint number and
- GetHint() ; get next hint
- endcase
-
- case 13 ; if Next was clicked,
- IncrementHint() ; increment hint number and
- GetHint() ; get next hint
- endcase
- endswitch
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* DECREMENTHINT *
- ;* *
- ;* This procedure decrements the current hint counter and updates HINTS.INI. *
- ;* *
- ;* Called by: ProcessDialogEvent *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: giHintNumber *
- ;* *
- ;*****************************************************************************
-
- proc DecrementHint
- if giHintNumber == 1 ; if hint is first hint
- giHintNumber = giLastHint ; set hint to last hint,
- else ; otherwise
- giHintNumber-- ; decrement hint by 1
- endif
- profilewr szHintsIni "CONFIG" "NextHint" giHintNumber ; update HINTS.INI
-
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* INCREMENTHINT *
- ;* *
- ;* This procedure increments the current hint counter and updates HINTS.INI. *
- ;* *
- ;* Called by: ProcessDialogEvent, ExitProgram *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: giHintNumber *
- ;* *
- ;*****************************************************************************
-
- proc IncrementHint
- if giHintNumber == giLastHint ; if hint is last hint
- giHintNumber = 1 ; set hint to first hint,
- else ; otherwise
- giHintNumber++ ; increment hint by 1
- endif
- profilewr szHintsIni "CONFIG" "NextHint" giHintNumber ; update HINTS.INI
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* CHECKSTARTUPSTATE *
- ;* *
- ;* This procedure queries the status of STARTUP.WAX and determines whether *
- ;* or not HINTS.WAX is compatible to the current version of STARTUP.WAX. If *
- ;* STARTUP.WAX doesn't exist, the procedure checks for the existance of *
- ;* STARTUP.WAS. If STARTUP.WAS does not exists, a new one is created. *
- ;* *
- ;* Called by: ExitProgram *
- ;* *
- ;* Calls: ExamineStartup, CreateStartup *
- ;* *
- ;* Modifies globals: bHintsEnable *
- ;* *
- ;*****************************************************************************
-
- proc CheckStartupState
- string szStartupHeader
-
- chdir $ASPECTPATH ; change directory to aspect
- if bHintsEnable ; if hints (startup) is enabled,
- isfile STARTUP_SCRIPT ; check for existance of STARTUP.WAX
- if failure ; if it doesn't exist
- isfile STARTUP_SOURCE ; check for existance of STARTUP.WAS
- if success ; if it exists,
- ExamineStartup() ; call proc to check compatibility
- else ; if it doesn't exist
- CreateStartup() ; call proc to create a new STARTUP
- endif
- else ; if STARTUP.WAX does exist
- fopen 0 STARTUP_SCRIPT READ ; determine if its header is from
- fread 0 szStartupHeader 35 ; the original STARTUP.WAX
- strcmp szStartupHeader szHEADER1
- if failure ; if it is not from the original,
- strcmp szStartupHeader szHEADER2 ; is it from the STARTUP
- ; script created above
- if failure ; if it's not,
- bHintsEnable = 0 ; disable hints and update
- dlgupdate 0 20 ; "Diplay at Startup" checkbox
- errormsg "The current version of STARTUP.WAX is not\
- compatible with HINTS.WAX. Rename or delete STARTUP.WAX."
- endif ; and display error message
- endif
- endif
- endif
- profilewr szPWIni "startup script" "Run Hints" bHintsEnable
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* EXAMINESTARTUP *
- ;* *
- ;* This procedure queries the status of STARTUP.WAS and determines whether *
- ;* or not HINTS.WAX is compatible to the current version of STARTUP.WAS. *
- ;* If it's not an errormsg appears. If it is, the user had the option to *
- ;* compile STARTUP.WAS *
- ;* *
- ;* Called by: CheckStartupState *
- ;* *
- ;* Calls: StartupOptions *
- ;* *
- ;* Modifies globals: bHintsEnable *
- ;* *
- ;*****************************************************************************
-
- proc ExamineStartup
- string szStartupHeader
- integer StartupChoice
-
- fopen 0 STARTUP_SOURCE READ ; determine if its header is from
- fread 0 szStartupHeader 35 ; the original STARTUP.WAX
- strcmp szStartupHeader szHEADER1
- if failure ; if it is not from the original,
- strcmp szStartupHeader szHEADER2 ; see if it's the HINTS STARTUP.WAS
- if failure ; if it is not,
-
- sdlgmsgbox "STARTUP Options" "The current version of STARTUP.WAS is \
- not compatible with HINTS.WAX. If you want the hints to be displayed at \
- startup, you'll need to rename STARTUP.WAS so HINTS.WAX can create a new \
- STARTUP.WAS. Would you like to have this program do that now?" EXCLAMATION \
- YESNO StartupChoice 2 BEEP
-
- if StartupChoice == 6
- rename STARTUP_SOURCE STARTUP_BACKUP
- usermsg "%s has been renamed to %s." STARTUP_SOURCE STARTUP_BACKUP
- CreateStartup()
- else
- bHintsEnable = 0 ; disable hints and update
- dlgupdate 0 20 ; "Diplay at Startup" checkbox
- endif
-
-
- else ; if it is a compatible STARTUP.WAS,
- StartupOptions() ; prompt the user to compile it
- endif
- else
- StartupOptions()
- endif
-
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* STARTUPOPTIONS *
- ;* *
- ;* This procedure informs the user that STARTUP.WAS exists and will work *
- ;* with HINTS.WAX but needs to be compiled for the Display at Startup option *
- ;* to work. The user is given the option to compile STARTUP.WAS *
- ;* *
- ;* Called by: ExamineStartup *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: bHintsEnable *
- ;* *
- ;*****************************************************************************
-
- proc StartupOptions
- integer CompileChoice
-
- sdlgmsgbox "STARTUP.WAS Options" "STARTUP.WAS has not been compiled. \
- To display hints at startup, STARTUP.WAS must be compiled. Compile it now?" \
- QUESTION YESNO CompileChoice 2
-
- if CompileChoice == 6
- compile "startup" "/X";compile STARTUP.WAS
- else
- bHintsEnable = 0 ; disable hints and update
- dlgupdate 0 20 ; "Diplay at Startup" checkbox
- endif
-
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* CREATESTARTUP *
- ;* *
- ;* This procedure creates and compiles a new STARTUP.WAS file that will *
- ;* check PW2.INI and launch HINTS.WAX if the Display at Startup option was *
- ;* enabled. *
- ;* *
- ;* Called by: CheckStartupState *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: None *
- ;* *
- ;*****************************************************************************
-
- proc CreateStartup
-
- fopen 0 STARTUP_SOURCE CREATE TEXT ; create a STARTUP.WAS
- fputs 0 "; startup.was - created by hints.wax"
- fputc 0 13
- fputc 0 10
- fputs 0 "proc Main"
- fputs 0 " chdir $WINPATH"
- fputs 0 " profilerd `"PW2.INI`" `"startup script`" `"Run Hints`" i0"
- fputs 0 " if i0 == 1"
- fputs 0 " chdir $ASPECTPATH"
- fputs 0 " execute `"hints.wax`""
- fputs 0 " endif"
- fputs 0 "endproc"
- fclose 0
-
- compile "startup" "/Q /X" ; compile STARTUP.WAS
-
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* EXITPROGRAM *
- ;* *
- ;* This procedure updates the hint counter and STARTUP.WAX information upon *
- ;* exiting the script. *
- ;* *
- ;* Called by: ProcessDialogEvent, (when USEREXIT) *
- ;* *
- ;* Calls: IncrementHint, CheckStartupState *
- ;* *
- ;* Modifies globals: *
- ;* *
- ;*****************************************************************************
-
- proc ExitProgram
- IncrementHint() ; increment the hint
- CheckStartupState() ; check for startup enable condition
- exit
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* DRAWDIALOG *
- ;* *
- ;* This procedure draws the main hints dialog box. *
- ;* *
- ;* Called by: Main *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: None *
- ;* *
- ;*****************************************************************************
-
- proc DrawDialog
-
- dialogbox 0 113 48 240 159 7 "Helpful Hints"
- groupbox 1 4 29 230 91
- groupbox 2 4 3 230 28
- text 5 34 13 177 9 szDialogHeader left
- text 6 215 13 15 8 szHintID center
- pushbutton 10 4 125 40 14 "&OK" default
- pushbutton 11 194 125 40 14 "&More Info"
- pushbutton 12 84 125 33 14 "&Previous"
- pushbutton 13 124 125 33 14 "&Next"
- checkbox 20 4 145 69 10 "&Display at Startup" bHintsEnable
- ftext 50 7 36 224 79 szHintsTxt offset lHintsTextOffset length lHintsTextLength
- icon 4 8 9 szIconFileName giIconHeaderIndex
- enddialog
-
- endproc
-
- ;*****************************************************************************
- ;* *
- ;* CENTERICON *
- ;* *
- ;* This procedure centers the category icon vertically in the header group *
- ;* box. It is needed to compensate for the different resolutions and font *
- ;* sizes supported by Windows. *
- ;* *
- ;* Called by: Main *
- ;* *
- ;* Calls: None *
- ;* *
- ;* Modifies globals: None *
- ;* *
- ;*****************************************************************************
-
- proc CenterIcon
- integer iIconY, iWinHeight, iWinx, iWinY, iWinWidth, iIconX, iDialogID
- integer iGroupID, iIconID
-
- dlgctrlwin 0 2 iGroupID ; get ID of group box
- dlgwin 0 iDialogID ; get ID of dialog box
- wincoord iGroupID iWinX iWinY iWinWidth iWinHeight ; get coordinates of
-
- dlgctrlwin 0 4 iIconID ; get ID of header icon
- wincoord iIconID iIconX iIconY i6 i7 ; get coordinates of header icon
- ; relative to screen and convert the
-
- iWinHeight = .5*(iWinHeight) ; get center point of group box
-
- iIconY = iWinY + iWinHeight - 12 ; calculate the Y coordinate of the
- ; header icon that'll center the
- ; icon in the group box.
-
- winmove iIconID iIconX iIconY ; move icon to the centered position
-
- endproc
- ;**** End of HINTS.WAS ****
-