home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Becoming a Computer Animator
/
COMPANIMATE.ISO
/
pc
/
windemos
/
pcanim
/
pcasetup.ms_
/
pcasetup.bin
Wrap
Text File
|
1994-02-15
|
11KB
|
381 lines
'**************************************************************************
'* PC Animate for Windows Setup Template
'**************************************************************************
''$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST APPHELP = 900
CONST CUSTINST = 6200
CONST TOOBIG = 6300
CONST BADPATH = 6400
''Bitmap ID
CONST LOGO = 1
GLOBAL DEST$ ''Default destination directory.
GLOBAL EXTRACOSTS$ ''List of extra costs to add per drive
GLOBAL OPTIONCOSTS$ ''List of Costs for each option
GLOBAL OPTIONNAMES$ ''List of Option Section Names
GLOBAL COSTARRAY$ ''List of Costs per drive
DECLARE SUB Install
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle "PC Animate for Windows Setup"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "PCASETUP.INF"
END IF
ReadInfFile szInf$
DEST$ = MakePath(GetWindowsDir, "ANIMATE")
EXTRACOSTS$ = "ExtraCosts"
FOR i% = 1 TO 26 STEP 1
AddListItem EXTRACOSTS$, "0"
NEXT i%
COSTARRAY$ = "CostArray"
SetSymbolValue COSTARRAY$, ""
FOR i% = 1 TO 26 STEP 1
AddListItem COSTARRAY$, "0"
NEXT i%
OPTIONNAMES$ = "OptionNames"
SetSymbolValue OPTIONNAMES$, ""
AddListItem OPTIONNAMES$, "Files"
AddListItem OPTIONNAMES$, "DOS"
AddListItem OPTIONNAMES$, "Tutorials"
AddListItem OPTIONNAMES$, "Archive"
OPTIONCOSTS$ = "OptionCosts"
FOR i% = 1 TO 4 STEP 1
AddListItem OPTIONCOSTS$, "0"
NEXT i%
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
END IF
IF HasMouseInstalled() = 0 THEN
i% = DoMsgBox("PC Animate for Windows Requires a Mouse.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
i% = GetWindowsMajorVersion()
IF i% > 3 THEN
i% = DoMsgBox("PC Animate for Windows Requires Windows 3.1.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
IF i% < 3 OR GetWindowsMinorVersion() < 10 THEN
i% = DoMsgBox("PC Animate for Windows Requires Windows 3.1.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
ENDIF
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
OPTION:
SetSymbolValue "CheckItemsState", ""
FOR i% = 1 TO 4 STEP 1
AddListItem "CheckItemsState", "ON"
NEXT i%
NEWDESTPATH:
IF MID$(DEST$, 2, 1) = ":" THEN
DESTDRV$ = MID$(DEST$, 1, 1)
ELSE
DESTDRV$ = WinDrive$
END IF
FOR i% = 1 TO 26 STEP 1
ReplaceListItem EXTRACOSTS$, i%, "0"
NEXT i%
FOR i% = 1 TO 4 STEP 1
ClearCopyList
IF i% = 3 THEN
AddSectionFilesToCopyList GetListItem(OPTIONNAMES$, i%), GetSymbolValue("STF_SRCDIR"), MakePath(DEST$, "tutorial")
ELSE
AddSectionFilesToCopyList GetListItem(OPTIONNAMES$, i%), GetSymbolValue("STF_SRCDIR"), DEST$
END IF
IF i% = 2 THEN
AddSectionFilesToCopyList "Drivers", GetSymbolValue("STF_SRCDIR"), MakePath(DEST$, "drivers")
END IF
StillNeed& = GetCopyListCost(EXTRACOSTS$, COSTARRAY$, "")
Cost& = 0
FOR n% = 1 to 26 STEP 1
Cost& = Cost& + VAL(GetListItem(COSTARRAY$, n%))
NEXT N%
IF i% = 1 THEN
Cost& = Cost& + 5120
END IF
ReplaceListItem OPTIONCOSTS$, i%, STR$(Cost)
NEXT i%
ClearCopyList
SetSymbolValue "StatusItemsText", ""
FOR i% = 1 TO 4 STEP 1
AddListItem "StatusItemsText", "Requires " + STR$(VAL(GetListItem(OPTIONCOSTS$, i%)) / 1024) + " K"
NEXT i%
NEWOPTIONS:
'' Calculate Costs based on selected Options
Costs& = 0
FOR i% = 1 TO 4 STEP 1
sz$ = GetListItem("CheckItemsState", i%)
IF sz$ = "ON" THEN
Costs& = Costs& + VAL(GetListItem(OPTIONCOSTS$, i%))
IF (i% = 1) AND (WinDrive$ = DESTDRV$) THEN
Costs& = Costs& + 5120
END IF
END IF
NEXT i%
SetSymbolValue "DriveStatusText", ""
AddListItem "DriveStatusText", DESTDRV$+":"
AddListItem "DriveStatusText", STR$(Costs& / 1024) + " K"
FreeSpace& = GetFreeSpaceForDrive(DESTDRV$)
AddListItem "DriveStatusText", STR$(FreeSpace& / 1024) + " K"
IF WinDrive$ = DESTDRV$ THEN
AddListItem "DriveStatusText", ""
AddListItem "DriveStatusText", ""
AddListItem "DriveStatusText", ""
ELSE
AddListItem "DriveStatusText", WinDrive$ + ":"
sz$ = GetListItem("CheckItemsState", 1)
IF sz$ = "ON" THEN
AddListItem "DriveStatusText", "5 K"
ELSE
AddListItem "DriveStatusText", "0 K"
ENDIF
FreeSpace& = GetFreeSpaceForDrive(WinDrive$)
AddListItem "DriveStatusText", STR$(FreeSpace& / 1024) + " K"
END IF
AddListItem "DriveStatusText", DEST$
OPTL1:
sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
FOR i% = 1 TO 26 STEP 1
ReplaceListItem EXTRACOSTS$, i%, "0"
NEXT i%
SrcDir$ = GetSymbolValue("STF_SRCDIR")
ClearCopyList
FOR i% = 1 TO 4 STEP 1
sz$ = GetListItem("CheckItemsState", i%)
IF sz$ = "ON" THEN
IF i% = 1 THEN
ndrive% = ASC(ucase$(WinDrive$)) - ASC("A") + 1
ReplaceListItem EXTRACOSTS$, ndrive%, "5120"
END IF
IF i% = 3 THEN
CreateDir MakePath(DEST$, "tutorial"), cmoNone
AddSectionFilesToCopyList GetListItem(OPTIONNAMES$, i%), SrcDir$, MakePath(DEST$, "tutorial")
ELSE
AddSectionFilesToCopyList GetListItem(OPTIONNAMES$, i%), SrcDir$, DEST$
END IF
IF i% = 2 THEN
CreateDir MakePath(DEST$, "drivers"), cmoNone
AddSectionFilesToCopyList "Drivers", SrcDir$, MakePath(DEST$, "drivers")
END IF
END IF
NEXT i%
StillNeed& = GetCopyListCost(EXTRACOSTS$, COSTARRAY$, "")
IF StillNeed& <> 0 THEN
GOSUB TOOBIG
GOTO OPTL1
END IF
UIPop(1)
ELSEIF sz$ = "REACTIVATE" THEN
GOTO OPTL1
ELSEIF sz$ = "PATH" THEN
GOSUB ASKPATH
GOTO NEWDESTPATH
ELSEIF MID$(sz$, 1, 3) = "CHK" THEN
GOTO NEWOPTIONS
ELSE
GOSUB ASKQUIT
GOTO OPTL1
END IF
Install
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, call Pacific Motion Technical Support at (415) 386-3173!", "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
ASKPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
DEST$ = GetSymbolValue("EditTextOut")
IF sz$ = "CONTINUE" THEN
IF MID$(DEST$, LEN(DEST$), 1) <> "\" THEN
DEST$ = DEST$ + "\"
END IF
CreateDir DEST$, cmoNone
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO OPTION
ELSE
GOSUB ASKQUIT
GOTO ASKPATH
END IF
RETURN
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG
END IF
UIPop 1
RETURN
'**
'** Purpose:
'** Performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
CreateDir DEST$, cmoNone
CopyFilesInCopyList
sz$ = GetListItem("CheckItemsState", 1)
IF sz$ = "ON" THEN
CreateProgmanGroup "PC Animate for Windows", "", cmoNone
ShowProgmanGroup "PC Animate for Windows", 1, cmoNone
CreateProgmanItem "PC Animate for Windows", "PC Animate for Windows", MakePath(DEST$, "PCAWIN.EXE"), "", cmoOverwrite
CreateProgmanItem "PC Animate for Windows", "Animation Player", MakePath(DEST$, "ANIPLAY.EXE"), "", cmoOverwrite
CreateProgmanItem "PC Animate for Windows", "PC Animate Help", "WINHELP.EXE "+MakePath(DEST$,"PCAWIN.HLP"), "", cmoOverwrite
CreateProgmanItem "PC Animate for Windows", "PC Animate Player Help", "WINHELP.EXE "+MakePath(DEST$,"ANIPLAY.HLP"), "", cmoOverwrite
CreateIniKeyValue "WIN.INI", "Extensions", "ani", MakePath(DEST$, "aniplay.exe")+" ^.ani", cmoOverwrite
CreateIniKeyValue "WIN.INI", "Extensions", "as", MakePath(DEST$, "aniplay.exe")+" ^.as", cmoOverwrite
ENDIF
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