home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dinomania
/
Dinomania.iso
/
dino.mst
< prev
next >
Wrap
Text File
|
1993-11-08
|
10KB
|
409 lines
'' ---------------------------------------------------------------------
''
'' Dinomania Setup
''
'' ---------------------------------------------------------------------
'' '$define DEBUG ''Define for script development/debugging
'' ---------------------------------------------------------------------
'$include 'setupapi.inc'
'$include 'msdetect.inc'
'' ---------------------------------------------------------------------
'' Resource ID's
CONST IDICN_SETUP = 6000
CONST IDBMP_LOGO = 6100
'' Custom Dialog IDs
CONST IDDLG_WELCOME = 100
CONST IDDLG_ASKQUIT = 200
CONST IDDLG_DESTPATH = 300
CONST IDDLG_EXITQUIT = 400
CONST IDDLG_EXITSUCCESS = 500
CONST IDDLG_NODISKSPACE = 600
CONST IDDLG_SELECTOPTIONS = 700
CONST IDDLG_PLEASEWAIT = 800
'' Custom user interface dll
CONST CUIDLL$ = "cui.dll"
'' ---------------------------------------------------------------------
'' Default destination directory.
GLOBAL DEST$
'' List of extra costs to add per drive
CONST szExtraCosts$ = "ExtraCosts"
CONST szCosts$ = "Costs"
'' Options
GLOBAL OptScreenSavers%
GLOBAL OptWallPapers%
GLOBAL OptIcons%
'' Section names, case sensitive: any files without a section go under "Files"
CONST ProgramKey$ = "dino"
CONST WallPaperKey$ = "wallpaper"
CONST IconKey$ = "icon"
'' ---------------------------------------------------------------------
'' My DLL functions
DECLARE FUNCTION IsStringInFile LIB "cui.dll" (lpszFilename$, lpszString$) AS INTEGER
'' Local function declarations
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE SUB BuildCopyList (_OptScreenSavers%, _OptWallPapers%, _OptIcons%)
DECLARE FUNCTION BytesPerOption (_OptScreenSavers%, _OptWallPapers%, _OptIcons%) AS LONG
DECLARE SUB DoInstall
DECLARE SUB AskQuit
DECLARE SUB AddGroupItem (szGroup$, szGrpFile$, szTitle$, ProgName$)
'' ---------------------------------------------------------------------
'' Lets do an installation ...
INIT:
ON ERROR GOTO QUIT
'' Some standard setup stuff
SetBitmap CUIDLL$, IDBMP_LOGO
SetTitle "Dinomania Setup"
'' Make a complete path to the INF file
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "DINO.INF"
END IF
'' Read in the INF file
ReadInfFile szInf$
'' Screen savers go in the windows directory
DEST$ = GetWindowsDir()
'' Default: select all options
OptScreenSavers% = 1
OptWallPapers% = 1
OptIcons% = 1
'$ifdef DEBUG
i% = SetSizeCheckMode(scmOnIgnore)
'$else
i% = SetSizeCheckMode(scmOnFatal)
'$endif
WELCOME:
sz$ = UIStartDlg(CUIDLL$, IDDLG_WELCOME, "FDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO WELCOME
ELSE
ASKQUIT
GOTO WELCOME
END IF
SELECTOPTIONS:
sz$ = UIStartDlg(CUIDLL$, IDDLG_PLEASEWAIT, "FModelessDlgProc", 0, "")
'' Screen savers
Bytes& = BytesPerOption&(1, 0, 0)
SetSymbolValue "Text1", STR$(Bytes& / 1024) + "K"
'' Wallpapers
Bytes& = BytesPerOption&(0, 1, 0)
SetSymbolValue "Text2", STR$(Bytes& / 1024) + "K"
'' Icons
Bytes& = BytesPerOption&(0, 0, 1)
SetSymbolValue "Text3", STR$(Bytes& / 1024) + "K"
'' Check the options
SetSymbolValue "CheckItemsIn", ""
IF OptScreenSavers% = 1 THEN
AddListItem "CheckItemsIn", "ON"
ELSE
AddListItem "CheckItemsIn", "OFF"
END IF
IF OptWallPapers% = 1 THEN
AddListItem "CheckItemsIn", "ON"
ELSE
AddListItem "CheckItemsIn", "OFF"
END IF
IF OptIcons% = 1 THEN
AddListItem "CheckItemsIn", "ON"
ELSE
AddListItem "CheckItemsIn", "OFF"
END IF
UIPop 1
SELECTOPTIONS1:
'' Run the dialog
sz$ = UIStartDlg(CUIDLL$, IDDLG_SELECTOPTIONS, "FDlgProc", 0, "")
IF sz$ = "CONTINUE" OR sz$ = "BACK" THEN
'' Retrieve the options
IF GetListItem("CheckItemsOut", 1) = "ON" THEN
OptScreenSavers% = 1
ELSE
OptScreenSavers% = 0
END IF
IF GetListItem("CheckItemsOut", 2) = "ON" THEN
OptWallPapers% = 1
ELSE
OptWallPapers% = 0
END IF
IF GetListItem("CheckItemsOut", 3) = "ON" THEN
OptIcons% = 1
ELSE
OptIcons% = 0
END IF
UIPop 1
IF sz$ = "BACK" THEN
GOTO WELCOME
END IF
ELSEIF sz$ = "REACTIVATE" THEN
GOTO SELECTOPTIONS '' Recalc sizes
ELSE
ASKQUIT
GOTO SELECTOPTIONS1
END IF
'' Like it says
BuildCopyList OptScreenSavers%, OptWallPapers%, OptIcons%
RECALC:
'' Check the amount of space needed
StillNeed& = GetCopyListCost("ExtraCostsList", "CostCostsList", "NeededCostsList")
IF StillNeed& <> 0 THEN
SPACE_CHECK_DLG:
'' Space required
SetSymbolValue "Text1", STR$(StillNeed& / 1024) + "K"
'' Space available
Bytes& = GetFreeSpaceForDrive(Mid$(DEST$, 1, 1))
SetSymbolValue "Text2", STR$(Bytes& / 1024) + "K"
sz$ = UIStartDlg(CUIDLL$, IDDLG_NODISKSPACE, "FDlgProc", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
GOTO SELECTOPTIONS
ELSEIF sz$ = "REACTIVATE" THEN
GOTO RECALC
ELSE
ASKQUIT
GOTO SPACE_CHECK_DLG
END IF
ENDIF
'' Perform the installation
DoInstall
QUIT:
IF ERR = 0 THEN
dlg% = IDDLG_EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = IDDLG_EXITQUIT
ELSE
dlg% = IDDLG_EXITQUIT
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FDlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
'' ---------------------------------------------------------------------
SUB BuildCopyList (_OptScreenSavers%, _OptWallPapers%, _OptIcons%) STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
ClearCopyList
IF _OptScreenSavers% = 1 THEN
AddSectionFilesToCopyList ProgramKey$, SrcDir$, DEST$
END IF
IF _OptWallPapers% = 1 THEN
AddSectionFilesToCopyList WallPaperKey$, SrcDir$, DEST$
END IF
IF _OptIcons% = 1 THEN
AddSectionFilesToCopyList IconKey$, SrcDir$, DEST$
END IF
END SUB
'' ---------------------------------------------------------------------
'**
'** Count the number of bytes needed to copy the given
'** section(s) to the users disk.
'**
FUNCTION BytesPerOption (_OptScreenSavers%, _OptWallPapers%, _OptIcons%) STATIC AS LONG
BuildCopyList _OptScreenSavers%, _OptWallPapers%, _OptIcons%
SetSymbolValue szExtraCosts$, ""
FOR i% = 1 TO 26 STEP 1
AddListItem szExtraCosts$, "0"
NEXT i%
'' Add extra cost to Windows drive for ini and progman additions
IF _OptScreenSavers% = 1 THEN
szWinDrive$ = MID$(GetWindowsDir, 1, 1)
ndrive% = ASC(ucase$(szWinDrive$)) - ASC("A") + 1
ReplaceListItem szExtraCosts$, ndrive%, "10240"
END IF
'' Compute the space
StillNeed& = GetCopyListCost(szExtraCosts$, szCosts$, "")
'' Add up the space required
cost& = 0
FOR i% = 1 TO 26 STEP 1
cost& = cost& + VAL(GetListItem(szCosts$, i%))
NEXT i%
BytesPerOption = cost&
END FUNCTION
'' ---------------------------------------------------------------------
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
SUB DoInstall STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
ClearBillboardList
CopyFilesInCopyList
sz$ = UIStartDlg(CUIDLL$, IDDLG_PLEASEWAIT, "FModelessDlgProc", 0, "")
IF OptScreenSavers% = 1 THEN
'' Create a video toys group
grp$ = "Video Toys"
grpfile$ = MakePath$(GetWindowsDir(), "videotoy.grp")
CreateProgmanGroup grp$, grpfile$, cmoNone
'' Place the order form file in the group window
IF IsStringInFile(grpfile$, "orderfrm.wri") = 0 THEN
CreateProgmanItem grp$, "Order Form", "write.exe " + MakePath$(DEST$, "orderfrm.wri"), "", cmoOverwrite
END IF
'' Add all the screen savers to the group (Alphabetized)
AddGroupItem grp$, grpfile$, "Dinosaur Fight", "dinofite.scr"
AddGroupItem grp$, grpfile$, "Diplodocus", "d