home *** CD-ROM | disk | FTP | other *** search
- '**************************************************************************
- '* MSSetup Script for AdobePS.drv 3.0
- '**************************************************************************
-
- '$DEFINE DEBUG ''Define for script development/debugging
-
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
-
- ''Dialog ID's
- CONST WELCOME = 100
- CONST ASKQUIT = 200
- CONST README = 300
- CONST QUITAPPS = 400
- CONST READONLY_DRV_EXIST = 450
- CONST NEWER_DRV_EXIST = 460
- CONST WINSYS = 500
- CONST EXITFAILURE = 600
- CONST EXITQUIT = 700
- CONST EXITSUCCESS = 800
- CONST EXITRESTART = 850
- CONST TOOBIG = 900
- CONST NOWRITE = 1000
- CONST APPHELPCE = 1100
- CONST APPHELPCBE = 1200
- CONST APPHELPRS = 1300
- CONST LOADING = 1400
- CONST INVISIBLE = 1500
-
- ''Bitmap ID
- CONST LOGO = 1
-
- GLOBAL DEST$ ''Default destination directory.
- GLOBAL TMPDIR$ ''Temporary Dir name
- GLOBAL Restart%
- GLOBAL RebootMsg%
-
- DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
-
- '******************************************************************
- '** Declare the funcitons in USER.EXE we need to register a
- '** unique message identifier and needed to post that message
- '** to the NSETUP.EXE program. See the Windows api documentation
- '** for additional information on these functions.
- '******************************************************************
- DECLARE FUNCTION PostMessage LIB "user" (hwnd%, msg%, wparam%, lparam&) AS INTEGER
- DECLARE FUNCTION RegisterWindowMessage LIB "user" (szRebootMessage$) AS INTEGER
-
- INIT:
- CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
- HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
-
- SetBitmap CUIDLL$, LOGO
- SetTitle "PostScript Printer Driver Setup"
-
- szInf$ = GetSymbolValue("STF_SRCINFPATH")
- IF szInf$ = "" THEN
- szInf$ = GetSymbolValue("STF_CWDDIR") + "PPDSETUP.INF"
- END IF
- ReadInfFile szInf$
-
- DEST$ = "C:\WINDOWS\SYSTEM"
- TMPDIR$ = ":\~pdrvset.t"
-
- '$IFDEF DEBUG
- i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
- WinDrive$ = MID$(GetWindowsDir, 1, 1)
- IF IsDriveValid(WinDrive$) = 0 THEN
- i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
- GOTO QUIT
- ELSE
- TMPDIR$ = WinDrive$ + TMPDIR$
- END IF
- '$ENDIF ''DEBUG
- '***************************************************************
- '** Here we go registering the message so we can communicate
- '** with NSETUP.EXE.
- '***************************************************************
- RebootMsg% = RegisterWindowMessage ("DrvSetup")
-
- README:
- sz$ = UIStartDlg(CUIDLL$, README, "FInfoDlgProc", APPHELPRS, HELPPROC$)
- IF sz$ = "BACK" THEN
- UIPop 1
- sz$ = UIStartDlg(CUIDLL$, LOADING, "FExecWrite", 0, "")
- IF sz$ = "CANCEL" THEN
- UIPop 1
- sz$ = UIStartDlg(CUIDLL$, NOWRITE, "FInfoDlgProc", 0, "")
- END IF
- END IF
- UIPop 1
-
-
- WELCOME:
- sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELPCE, HELPPROC$)
- IF sz$ = "CONTINUE" THEN
- UIPop 1
- ELSE
- GOSUB ASKQUIT
- GOTO WELCOME
- END IF
-
- '' README: moved to the front of WELCOME:
-
-
- CHECKBUSY:
- WINDOWS$ = GetWindowsDir ()
- SetSymbolValue "WindowsDir", WINDOWS$
- DEST$ = GetWindowsSysDir ()
- SetSymbolValue "WindowsSysDir", DEST$
- IF IsDirWritable(DEST$) = 0 THEN
- SetSymbolValue "WinSysDirWritable", "0"
- ELSE
- SetSymbolValue "WinSysDirWritable", "1"
- END IF
-
- sz$ = UIStartDlg(CUIDLL$, INVISIBLE, "FBusyModule", 0, "")
- IF sz$ = "REALBUSY" THEN
- dlg% = QUITAPPS
- sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfoDlgProc", 0, "")
- Restart%=0
- UIPopAll
- END
- END IF
-
- IF sz$ = "NEWDRVEXIST" THEN
- dlg% = NEWER_DRV_EXIST
- sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfoDlgProc", 0, "")
- Restart%=0
- UIPopAll
- END
- ELSEIF sz$ = "DRVEXISTINSYS" THEN
- dlg% = READONLY_DRV_EXIST
- sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfoDlgProc", 0, "")
- Restart%=0
- UIPopAll
- END
- ELSEIF sz$ = "BUSY" THEN
- '' remember to re-start windows at the end. Fix bug 260
- Restart%=1
- ELSE
- Restart%=0
- END IF
- UIPop 1
-
-
- CHECKWIN:
- DEST$ = GetWindowsSysDir ()
-
- IF IsDirWritable(DEST$) = 0 THEN
- sz$ = UIStartDlg(CUIDLL$, WINSYS, "FInfoDlgProc", APPHELPCBE, HELPPROC$)
- IF sz$ = "CONTINUE" THEN
- DEST$ = GetWindowsDir ()
- UIPop 1
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- GOTO README
- ELSE
- GOSUB ASKQUIT
- GOTO WELCOME
- END IF
- END IF
-
- GOSUB INSTALL
-
- ini$ = MakePath(DEST$, "CONTROL.INI")
- CreateIniKeyValue ini$, "MMCPL", "AdobeApps", "adobepsi.cpl" , cmoNone
-
- QUIT:
- ON ERROR GOTO ERRQUIT
-
- IF ERR = 0 THEN
- IF Restart% = 0 THEN
- '' always restart if sucess: dlg% = EXITSUCCESS
- dlg% = EXITRESTART
- ELSE
- dlg% = EXITRESTART
- END IF
- ELSEIF ERR = STFQUIT THEN
- dlg% = EXITQUIT
- ELSE
- dlg% = EXITFAILURE
- END IF
- QUITL1:
- sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfoDlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO QUITL1
- ELSEIF sz$ = "EXIT" THEN
- i% = PostMessage (65535, RebootMsg%, 0, 0)
- '' doesn't work for 3.11: dlg%=ExitExecRestart()
- '' only one button now:
- '' ELSEIF sz$ = "CANCEL" THEN
- '' i% = DoMsgBox("Setup copied files correctly, you may need to restart Windows to use the new driver", "Setup Message", MB_OK+MB_TASKMODAL)
- END IF
- UIPop 1
-
- END
-
- ERRQUIT:
- i% = DoMsgBox("Setup sources were corrupted, call technical support!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
- END
-
- BADPATH:
- sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO BADPATH
- END IF
- UIPop 1
- RETURN
-
-
- ASKQUIT:
- sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
-
- IF sz$ = "EXIT" THEN
- UIPopAll
- ERROR STFQUIT
- ELSEIF sz$ = "REACTIVATE" THEN
- GOTO ASKQUIT
- ELSE
- UIPop 1
- END IF
- RETURN
-
- '**
- '** Purpose:
- '** Builds the copy list and performs all installation operations.
- '** Arguments:
- '** none.
- '** Returns:
- '** none.
- '*************************************************************************
- INSTALL:
-
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
-
- '' SetRestartDir TMPDIR$
- '' Copy the Readme.wri ourselves: fix bug 470: use ini$ temporarily:
- szReadme$ = GetSymbolValue("DRV_README")
- szSrcReadme$ = MakePath(SrcDir$, szReadme$)
- szDestReadme$ = MakePath(DEST$, szReadme$)
- CopyFile szSrcReadme$, szDestReadme$, cmoOverwrite,0
-
- '' Copy Watermar.INI now: fix bug 458
- szWater$ = GetSymbolValue("DRV_WATER")
- szSrcWater$ = MakePath(SrcDir$, szWater$)
- DEST_WIN$ = GetWindowsDir ()
- szDestWater$ = MakePath(DEST_WIN$, szWater$)
- '' copy only if "watermar.ini" doesn't exist:
- Wet%=DoesFileExist(szDestWater$, femExists)
- IF Wet% = 0 THEN
- CopyFile szSrcWater$, szDestWater$, cmoBackup,0
- END IF
-
- AddSectionFilesToCopyList "Files", SrcDir$, DEST$
- CopyFilesInCopyList
-
- RETURN
-
-
- '**
- '** Purpose:
- '** Appends a file name to the end of a directory path,
- '** inserting a backslash character as needed.
- '** Arguments:
- '** szDir$ - full directory path (with optional ending "\")
- '** szFile$ - filename to append to directory
- '** Returns:
- '** Resulting fully qualified path name.
- '*************************************************************************
- FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
- IF szDir$ = "" THEN
- MakePath = szFile$
- ELSEIF szFile$ = "" THEN
- MakePath = szDir$
- ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
- MakePath = szDir$ + szFile$
- ELSE
- MakePath = szDir$ + "\" + szFile$
- END IF
- END FUNCTION
-
-