home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 October A / Pcwk10a98.iso / Corel / Ventura8 / Ventura / Scripts / PrintScheduler.csc < prev    next >
Encoding:
Text File  |  1998-07-08  |  2.9 KB  |  85 lines

  1. REM Corel VENTURA Print Scheduler Wizard [CorelSCRIPT 8]
  2. REM PrintScheduler.csc  February 5, 1998
  3. REM ⌐ 1998 Corel Corporation. All rights reserved.
  4.  
  5. REM **************************************************************************************
  6. REM This script launches the PrintSch script executable. If the executable cannot be
  7. REM located, the user is prompted to locate this file themself, or exit the script.
  8. REM **************************************************************************************
  9.  
  10. ' Create a temporary folder to provide a path for the include files
  11. '  -this enables the include files to be located 
  12. #addfol "..\..\Scripts"
  13. #include "ScpConst.csi"
  14. #include "VPConst.csi"
  15.  
  16.  
  17. '/////FUNCTION & SUBROUTINE DECLARATIONS/////////////////////////////////////////////////
  18. DECLARE SUB RegQuery()
  19.  
  20. '/////GLOBAL VARIABLES & CONSTANTS///////////////////////////////////////////////////////
  21. GLOBAL VenturaRoot$                'Ventura root installation directory from registry
  22.  
  23. ' **************************************************************************************
  24. ' MAIN
  25. ' **************************************************************************************
  26. ON ERROR GOTO ErrorHandler
  27.  
  28. RegQuery            'get root directory where Ventura is installed
  29. ExecutableFile$ = VenturaRoot$ & "\Ventura\Scripts\PrintScheduler.exe"
  30.  
  31. Start:
  32. ProcessStatus& = STARTPROCESS(ExecutableFile$)
  33. IF ProcessStatus& = 0 THEN 
  34.     Msg$ = "Unable to locate " & ExecutableFile$ & CHR(13) & "Would you like to look for the file yourself?"
  35.     MsgStatus& = MESSAGEBOX(Msg$, "Missing Executable", MB_OK_CANCEL OR MB_QUESTION_ICON)
  36.     IF MsgStatus& = MSG_OK THEN 
  37.         ExecutableFile$ = GETFILEBOX( "", , , ExecutableFile$)
  38.         IF ExecutableFile$ <> "" THEN GOTO Start    
  39.     ENDIF    
  40. ENDIF
  41.  
  42. ExitScript:
  43. STOP
  44.  
  45. ErrorHandler:
  46. SELECT CASE ErrNum
  47.     CASE 800
  48.         MESSAGE "FATAL ERROR" & CHR(13) & "Script will now exit."
  49.         RESUME AT ExitScript
  50.     CASE ELSE
  51.         MESSAGE "ERROR: " & STR(ErrNum) & CHR(13) & "Script will now exit."
  52.         RESUME AT ExitScript
  53.     END SELECT
  54.  
  55.  
  56. ' *******************************************************************************
  57. ' RegQuery
  58. ' This subroutine queries the Registry to determine the root directory where 
  59. ' Ventura is installed.
  60. ' *******************************************************************************
  61. SUB RegQuery
  62. ON ERROR GOTO ErrorHandler
  63.  
  64.     'get Ventura config directory
  65.     VentDir$ = REGISTRYQUERY(HKEY_LOCAL_MACHINE,VENTURA_REGQUERY_CONST,"ConfigDir")     
  66.     
  67.     'isolate Ventura root directory from Ventura config directory
  68.     first% = 1
  69.     pos% = 1
  70.     DO WHILE first <> 0
  71.         first = INSTR(VentDir$, "\", first )
  72.         IF first <> 0 THEN
  73.             pos = first
  74.             first = first + 1
  75.         END IF
  76.     LOOP
  77.     VenturaRoot$ = LEFT(VentDir$, pos - 1)     'root directory where Ventura is installed
  78.  
  79. EXIT SUB
  80. ErrorHandler:
  81.     MESSAGE "Error reading registry:" & CHR(13) & RegString$
  82.     ErrNum = 800
  83. END SUB
  84.  
  85.