home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip Hitware 3
/
Chip_Hitware_Vol_03.iso
/
chiphit3
/
dfu
/
intelect
/
disk1
/
setup.mst
< prev
next >
Wrap
Text File
|
1995-07-23
|
7KB
|
264 lines
'**************************************************************************
'* Clearwave Intellect installation script
'**************************************************************************
''$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 OPTIONS = 800
CONST APPHELP = 900
CONST CUSTINST = 6200
CONST TOOBIG = 6300
CONST BADPATH = 6400
CONST CONFIRMINFO = 7300
CONST GETNAMEORG = 7500
CONST CDBADNAME = 7700
''Bitmap ID
CONST LOGO = 1
GLOBAL CUSTNAME$ ''Customer name.
GLOBAL CUSTORG$ ''Customer organization.
GLOBAL DEST$ ''Default destination directory.
GLOBAL WINDEST$ ''Windows directory.
GLOBAL WINDRIVE$ ''Windows drive letter.
''Function prototypes
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION IsEnoughDiskSpace () AS INTEGER
INIT:
CUIDLL$ = "mscuistf.dll" ''custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
PRODUCT$="Intellect"
GROUP$=PRODUCT$
WINDEST$ = GetWindowsDir
WINDRIVE$ = MID$(WINDEST$, 1, 1)
DEST$ = WINDRIVE$ + ":\INTLLCT"
SetBitmap CUIDLL$, LOGO
SetTitle PRODUCT$+" Setup"
''Resize main setup window to fill screen
Dim hWnd%, nWidth%, nHeight%
hWnd% = HwndFrame()
nWidth% = GetScreenWidth()
nHeight% = GetScreenHeight()
SetWindowPos hWnd%, 0, 0, 0, nWidth%, nHeight%, SWP_NOZORDER
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "SETUP.INF"
END IF
ReadInfFile szInf$
WELCOME:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "ALL"
WELCOMEL1:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FEditDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
DEST$ = GetSymbolValue("EditTextOut")
''Validate new path.
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO WELCOMEL1
END IF
GOTO REGISTER
ELSEIF sz$ = "REACTIVATE" THEN
GOTO WELCOMEL1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
ENDIF
REGISTER:
AddListItem "ConfirmTextIn", CUSTNAME$
AddListItem "ConfirmTextIn", CUSTORG$
REGISTER2:
sz$ = UIStartDlg(CUIDLL$, GETNAMEORG, "FNameOrgDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
CUSTNAME$ = GetSymbolValue("NameOut")
IF CUSTNAME$ = "" THEN
GOSUB BADNAME
GOTO REGISTER
ENDIF
CUSTORG$ = GetSymbolValue("OrgOut")
GOTO CONFREG
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WELCOME
ELSE
GOSUB ASKQUIT
GOTO REGISTER
ENDIF
CONFREG:
ReplaceListItem "ConfirmTextIn", 1, CUSTNAME$
ReplaceListItem "ConfirmTextIn", 2, CUSTORG$
sz$ = UIStartDlg(CUIDLL$, CONFIRMINFO, "FConfirmDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
''SMS Add code to write registration info to program.
UIPop 2
GOTO INSTALL
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO REGISTER2
ELSE
GOSUB ASKQUIT
GOTO CONFREG
ENDIF
INSTALL:
SrcDir$ = GetSymbolValue("STF_SRCDIR")
ClearCopyList
AddSectionFilesToCopyList "Intellect Files", SrcDir$, DEST$
AddSectionFilesToCopyList "Demo Files", SrcDir$, DEST$+"\demo\"
AddSectionFilesToCopyList "TAPI Files", SrcDir$, WINDEST$
AddSectionFilesToCopyList "System Files", SrcDir$, WINDEST$+"system\"
AddSectionFilesToCopyList "Windows Files", SrcDir$, WINDEST$
''Check to see if we have enough disk space for installation
IF IsEnoughDiskSpace() = 1 THEN
GOSUB TOOBIG
GOTO WELCOME
ENDIF
CreateDir DEST$, cmoNone
CreateDir DEST$+"\DEMO", cmoNone
CreateDir DEST$+"\INDNOTES", cmoNone
CreateDir DEST$+"\SUBNOTES", cmoNone
OpenLogFile DEST$ + "\SETUP.LOG", FALSE
DumpCopyList DEST$ + "\SETUP.LOG"
Intellect$=MakePath(DEST$,"intllct.exe")
IF DoesFileExist(Intellect$, femExists)=0 THEN
CopyFilesInCopyList
UpdateTelephonIni Intellect$
CreateProgmanGroup GROUP$, "", cmoNone
CreateProgmanItem GROUP$, PRODUCT$, Intellect$, "", cmoOverwrite
CreateProgmanItem GROUP$, PRODUCT$+" Demo", Intellect$+" Demo", "", cmoOverwrite
CreateProgmanItem GROUP$, PRODUCT$+" Help", "WINHELP.EXE " + MakePath(DEST$,"intllct.hlp"), "", cmoOverwrite
CreateProgmanItem GROUP$, "Read Me First", "NOTEPAD.EXE " + MakePath(DEST$,"readme.txt"), "", cmoOverwrite
ShowProgmanGroup GROUP$, 1, cmoNone
ELSE
CopyFilesInCopyList
UpdateTelephonIni Intellect$
ENDIF
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
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO TOOBIG
END IF
UIPop 1
RETURN
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
BADNAME:
sz$ = UIStartDlg(CUIDLL$, CDBADNAME, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADNAME
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:
'** 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
FUNCTION IsEnoughDiskSpace () STATIC AS INTEGER
StillNeed& = GetCopyListCost("", "", "")
IF StillNeed > 0 THEN
IsEnoughDiskSpace = 1
ELSE
IsEnoughDiskSpace = 0
END IF
END FUNCTION