home *** CD-ROM | disk | FTP | other *** search
- '**************************************************************************
- '* for PhotoStudio Setup
- '**************************************************************************
-
- '' no debug '$DEFINE DEBUG ''Define for script development/debugging
-
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
-
- ''Dialog ID's
- CONST ASKQUIT = 200
- CONST DESTPATH = 300
- CONST EXITFAILURE = 400
- CONST EXITQUIT = 600
- CONST EXITSUCCESS = 700
- CONST OPTIONS = 800
- CONST APPHELP = 900
- CONST CUSTINST = 6200
- CONST TOOBIG = 6300
- CONST BADPATH = 6400
-
- ''Bitmap ID
- CONST LOGO = 1
-
- GLOBAL DEST$ ''Default destination directory.
- GLOBAL WINDRIVE$ ''Windows drive letter.
-
- ''Dialog list symbol names
- GLOBAL CHECKSTATES$
- GLOBAL STATUSTEXT$
- GLOBAL DRIVETEXT$
-
-
- DECLARE SUB SetDriveStatus
- DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
-
-
-
- INIT:
- CUIDLL$ = "mscuistf.dll" ''custom user interface dll
- HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
-
- SetBitmap CUIDLL$, LOGO
- SetTitle "PhotoStudio Setup"
-
- szInf$ = GetSymbolValue("STF_SRCINFPATH")
- IF szInf$ = "" THEN
- szInf$ = GetSymbolValue("STF_CWDDIR") + "PSTUDIO.INF"
- END IF
- ReadInfFile szInf$
-
- WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
- DEST$ = WINDRIVE$ + ":\PSTUDIO"
-
- ''CustInst list symbols
- CHECKSTATES$ = "CheckItemsState"
- STATUSTEXT$ = "StatusItemsText"
- DRIVETEXT$ = "DriveStatusText"
- FOR i% = 1 TO 3 STEP 1
- AddListItem CHECKSTATES$, "ON"
- NEXT i%
- FOR i% = 1 TO 3 STEP 1
- AddListItem STATUSTEXT$, ""
- NEXT i%
- FOR i% = 1 TO 7 STEP 1
- AddListItem DRIVETEXT$, ""
- NEXT i%
- ReplaceListItem DRIVETEXT$, 7, DEST$
-
- SetDriveStatus
-
- '$IFDEF DEBUG
- i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
- '$ENDIF ''DEBUG
-
-
-
- CUSTINST:
- sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
-
- IF sz$ = "CONTINUE" THEN
- UIPop 1
- GOTO INSTALL
- ELSEIF sz$ = "PATH" THEN
- GOTO GETPATH
- ELSEIF sz$ = "REACTIVATE" THEN
- SetDriveStatus
- GOTO CUSTINST
- ELSE
- GOSUB ASKQUIT
- GOTO CUSTINST
- END IF
-
-
-
- INSTALL:
- ClearCopyList
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
- WinDir$ = GetWindowsDir()
- AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
- AddSectionFilesToCopyList "Plugins", SrcDir$, MakePath(DEST$,"PLUGINS")
- AddSectionFilesToCopyList "Patterns", SrcDir$, MakePath(DEST$,"PATTERNS")
- AddSectionFilesToCopyList "Samples", SrcDir$, MakePath(DEST$,"SAMPLES")
- AddSectionFilesToCopyList "Albums", SrcDir$, MakePath(DEST$,"ALBUMS")
- AddSectionFilesToCopyList "Stamps", SrcDir$, MakePath(DEST$,"STAMPS")
- AddSectionFilesToCopyList "SysFiles", SrcDir$, WinDir$
- CreateDir DEST$, cmoNone
- CopyFilesInCopyList
-
- '' CreateIniKeyValue WinDir$ + "system.ini", "boot", "SCRNSAVE.EXE", MakePath(WinDir$,"ASSLDSHW.SCR"), cmoOverwrite
- CreateIniKeyValue WinDir$ + "control.ini", "ScreenSaver.ArcSoft Slide Show", "Path", MakePath(DEST$,"albums\"), cmoOverwrite
- '' CreateIniKeyValue WinDir$ + "win.ini", "windows", "ScreenSaveActive", "1", cmoOverwrite
- '' CreateIniKeyValue WinDir$ + "win.ini", "Extensions", "bmp", MakePath(DEST$,"pstudio.exe ^.bmp"), cmoOverwrite
- '' CreateIniKeyValue WinDir$ + "win.ini", "Extensions", "tif", MakePath(DEST$,"pstudio.exe ^.tif"), cmoOverwrite
- '' CreateIniKeyValue WinDir$ + "win.ini", "Extensions", "jpg", MakePath(DEST$,"pstudio.exe ^.jpg"), cmoOverwrite
- CreateProgmanGroup "PhotoStudio", "", cmoNone
- ShowProgmanGroup "PhotoStudio", 1, cmoNone
- CreateProgmanItem "PhotoStudio", "PhotoStudio 2.0", MakePath(DEST$,"pstudio.exe"), "", cmoOverwrite
- CreateProgmanItem "PhotoStudio", "Register & Order", MakePath(DEST$,"qkorder.exe"), "", cmoOverwrite
- CreateProgmanItem "PhotoStudio", "PhotoStudio Readme", "write.exe "+MakePath(DEST$,"readme.wri"), "", cmoOverwrite
- CreateProgmanItem "PhotoStudio", "PhotoStudio Help", "winhelp.exe "+MakePath(DEST$,"pstudio.hlp"), "", cmoOverwrite
-
- QUIT:
- ON ERROR GOTO ERRQUIT
-
- IF ERR = 0 THEN
- dlg% = EXITSUCCESS
- ELSEIF ERR = STFQUIT THEN
- dlg% = EXITQUIT
- ELSE
- dlg% = EXITFAILURE
- END IF
- QUITL1:
- sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO QUITL1
- END IF
- UIPop 1
-
- END
-
- ERRQUIT:
- i% = DoMsgBox("Setup sources were corrupted!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
- END
-
-
-
- GETPATH:
- SetSymbolValue "EditTextIn", DEST$
- SetSymbolValue "EditFocus", "END"
- GETPATHL1:
- sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
-
- IF sz$ = "CONTINUE" THEN
- olddest$ = DEST$
- DEST$ = GetSymbolValue("EditTextOut")
-
- ''Validate new path.
- IF IsDirWritable(DEST$) = 0 THEN
- GOSUB BADPATH
- GOTO GETPATHL1
- END IF
- UIPop 1
-
- ''Truncate display if too long.
- IF LEN(DEST$) > 23 THEN
- ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
- ELSE
- ReplaceListItem DRIVETEXT$, 7, DEST$
- END IF
-
- ''Recalc if path changed.
- IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
- SetDriveStatus
- END IF
-
- olddest$ = ""
- GOTO CUSTINST
- ELSEIF sz$ = "REACTIVATE" THEN
- SetDriveStatus
- GOTO GETPATHL1
- ELSEIF sz$ = "EXIT" THEN
- GOSUB ASKQUIT
- GOTO GETPATHL1
- ELSE
- UIPop 1
- GOTO CUSTINST
- END IF
-
-
- BADPATH:
- sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- SetDriveStatus
- 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:
- '** Sets drive status info according to latest disk space calcs.
- '** Arguments:
- '** none.
- '** Returns:
- '** none.
- '*************************************************************************
- SUB SetDriveStatus STATIC
-
- drive$ = MID$(DEST$, 1, 1)
- ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
- cost& = 3100
- free& = GetFreeSpaceForDrive(drive$)
- ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
- ReplaceListItem DRIVETEXT$, 2, STR$(cost&) + " K"
- ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
-
- END SUB
-
-
- '**
- '** 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
-