home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Buyer 1995 December
/
buyer-1295.iso
/
superof
/
superoff.mst
< prev
next >
Wrap
Text File
|
1993-01-10
|
27KB
|
1,004 lines
'**************************************************************************
'* MSSetup For SuperOffice Norsk
'**************************************************************************
'DEFINE DEBUG
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'$INCLUDE 'msshared.inc'
''Dialog ID's
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
CONST ASKTYPE = 9000
CONST ASKDATAPATH = 9100
CONST CUSTUPGRADE = 9200
CONST ASKOVERWRITE = 9300
CONST ASKWORKSTN = 9500
CONST TRAVELINST = 9600
''Bitmap ID
CONST LOGO = 1
''File Types
CONST DATAFILES = 1
GLOBAL PROGDEST$ ''Default destination directory.
GLOBAL ARCDEST$ ''Default data destination directory.
GLOBAL PROG$ '' PROG
GLOBAL DATAD$ '' DATA
GLOBAL TEMPLATED$ '' TEMPLATE
GLOBAL WINDRIVE$ ''Windows drive letter.
GLOBAL OPT1OPT$ ''Option selection from OptFiles1 option dialog.
GLOBAL SrcDir$
GLOBAL ListSym$
GLOBAL NetDir$
GLOBAL DBLIBTYPE$ ''NETWORK or SINGLE selects CTPWIN.DLL type
''CustInst list symbol names
GLOBAL APPNEEDS$ ''Option list costs per drive
GLOBAL OPT1NEEDS$
GLOBAL EXTRACOSTS$ ''List of extra costs to add per drive
GLOBAL BIGLIST$ ''List of option files cost calc results (boolean)
''Dialog list symbol names
GLOBAL CHECKSTATES$
GLOBAL STATUSTEXT$
GLOBAL DRIVETEXT$
GLOBAL WORDLIST$
GLOBAL SPREADLIST$
GLOBAL FullInst$
GLOBAL szInf$
GLOBAL APP$
GLOBAL WSAPP$
GLOBAL SSAPP$
GLOBAL LISTSTRING$
DECLARE SUB ErrorMsg (errnum%)
DECLARE SUB WriteInstallIni
DECLARE SUB BuildCopyList
DECLARE SUB RecalcFiles (ftype%)
DECLARE SUB RecalcPath
DECLARE SUB SetDriveStatus
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
INIT:
IF GetWindowsMajorVersion() < 3 THEN
'' Cannot run on versions previous to 3.0
ErrorMsg(1)
END
END IF
CUIDLL$ = "mscuistf.dll" ''custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle "SuperOffice Installation"
''CustInst list symbols
CHECKSTATES$ = "CheckItemsState"
STATUSTEXT$ = "StatusItemsText"
DRIVETEXT$ = "DriveStatusText"
WORDLIST$ = "WordProcessor"
SPREADLIST$ = "Spreadsheet"
FOR i% = 1 TO 3 STEP 1
AddListItem STATUSTEXT$, ""
NEXT i%
AddListItem CHECKSTATES$, "ON"
SrcDir$ = GetSymbolValue("STF_SRCDIR")
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "SUPEROFF.INF"
END IF
ReadInfFile szInf$
WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
PROGDEST$ = WINDRIVE$ + ":\SUPEROFF"
ARCDEST$ = WINDRIVE$ + ":\SO_ARC"
DATAD$ = "DATA"
TEMPLATED$ = "TEMPLATE"
FOR i% = 1 TO 10 STEP 1
AddListItem DRIVETEXT$, ""
NEXT i%
ReplaceListItem DRIVETEXT$, 7, PROGDEST$
ReplaceListItem DRIVETEXT$, 8, ARCDEST$
ReplaceListItem DRIVETEXT$, 9, "Microsoft Word"
ReplaceListItem DRIVETEXT$,10, "Microsoft Excel"
AddListItem WORDLIST$, "Microsoft Word"
AddListItem WORDLIST$, "WordPerfect"
AddListItem WORDLIST$, "Ami Pro"
AddListItem WORDLIST$, "Windows Write"
AddListItem WORDLIST$, "Other Word Processor"
AddListItem SPREADLIST$, "Microsoft Excel"
AddListItem SPREADLIST$, "Lotus 1-2-3"
AddListItem SPREADLIST$, "Other Spreadsheet"
''Disk cost list symbols
APPNEEDS$ = "AppNeeds"
OPT1NEEDS$ = "Opt1Needs"
EXTRACOSTS$ = "ExtraCosts"
BIGLIST$ = "BigList"
FOR i% = 1 TO 3 STEP 1
AddListItem BIGLIST$, ""
NEXT i%
FOR i% = 1 TO 26 STEP 1
AddListItem EXTRACOSTS$, "0"
NEXT i%
ReplaceListItem EXTRACOSTS$, 3, "1024"
''File Option Variables
OPT1OPT$ = "1"
SetRestartDir GetWindowsDir
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
'' Check if Workstation installation
IF "" = FindFileUsingFileOpen(MakePath$(SrcDir$, "SUPEROFF\SUPEROFF.EXE")) THEN
ARCDEST$ = WINDRIVE$ + ":\SO_LOCAL"
ReplaceListItem DRIVETEXT$, 8, ARCDEST$
IF LEN(SrcDir$) < 10 THEN
ErrorMsg(2)
END IF
IF MID$(SrcDir$, LEN(SrcDir$), 1) = "\" THEN
NetDir$ = MID$(SrcDir$, 1, LEN(SrcDir$) - 9)
ELSE
NetDir$ = MID$(SrcDir$, 1, LEN(SrcDir$) - 8)
END IF
GOTO WRKSTNASK
END IF
TYPEASK:
'' Ask for Single User, Network or Workstation installation
sz$ = UIStartDlg(CUIDLL$, ASKTYPE, "FAskTypeDlgProc", APPHELP, HELPPROC$)
IF sz$ = "NETWORK" THEN
DBLIBTYPE$ = "NETWORK"
FullInst$ = "ON"
UIPop 1
GOTO CUSTINST
ELSEIF sz$ = "SINGLE" THEN
DBLIBTYPE$ = "SINGLE"
FullInst$ = "ON"
UIPop 1
GOTO CUSTINST
ELSEIF sz$ = "UNETWORK" THEN
DBLIBTYPE$ = "NETWORK"
FullInst$ = "OFF"
UIPop 1
GOTO UPGRADE
ELSEIF sz$ = "USINGLE" THEN
DBLIBTYPE$ = "SINGLE"
FullInst$ = "OFF"
UIPop 1
GOTO UPGRADE
ELSE
GOSUB ASKQUIT
GOTO TYPEASK
END IF
CUSTINST:
SetDriveStatus
sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
''Install only if it will fit.
FOR i% = 1 TO 3 STEP 1
IF GetListItem(BIGLIST$, i%) <> "" THEN
GOSUB TOOBIG
GOTO CUSTINST
END IF
NEXT i%
UIPop 1
GOTO INSTALL
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO TYPEASK
ELSEIF sz$ = "PATH" THEN
GOTO GETPATH
ELSEIF sz$ = "DPATH" THEN
GOTO GETDPATH
ELSEIF sz$ = "CHK1" THEN
GOTO CUSTINST
ELSEIF sz$ = "REACTIVATE" THEN
GOTO CUSTINST
ELSE
GOSUB ASKQUIT
GOTO CUSTINST
END IF
'' -------------------------------------- Install -------------------------
INSTALL:
BuildCopyList
CreateDir PROGDEST$, cmoNone
IF FullInst$ = "ON" THEN
IF "" <> FindFileUsingFileOpen(MakePath(ARCDEST$, DATAD$) + "\superoff.dat") THEN
GOSUB ASKOVERWRITE
END IF
IF "" <> FindFileUsingFileOpen(PROGDEST$ + "\install.ini") THEN
RemoveFile PROGDEST$ + "\install.ini", cmoForce
END IF
CreateDir ARCDEST$, cmoNone
CreateDir MakePath(ARCDEST$, DATAD$), cmoNone
CreateDir MakePath(ARCDEST$, TEMPLATED$), cmoNone
END IF
''DumpCopyList("C:\SUPEROFF\SETUP.LOG")
CopyFilesInCopyList
IF FullInst$ = "ON" THEN
IF DBLIBTYPE$ = "SINGLE" THEN
'' modify WPC.INI Update Shared DLL files
END IF
WriteInstallIni
END IF
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
IF ERR = 0 AND RestartListEmpty = 0 THEN
IF GetWindowsMinorVersion < 1 THEN
ErrorMsg(3)
ELSE
ErrorMsg(4)
j% = ExitExecRestart()
IF j% = 0 THEN
ErrorMsg(5)
END IF
END IF
END IF
END
ERRQUIT:
ErrorMsg(6)
END
GETPATH:
SetSymbolValue "EditTextIn", PROGDEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
olddest$ = PROGDEST$
PROGDEST$ = GetSymbolValue("EditTextOut")
''Validate new path.
IF IsDirWritable(PROGDEST$) = 0 THEN
GOSUB BADPATH
PROGDEST$ = olddest$
GOTO GETPATHL1
END IF
UIPop 1
''Truncate display if too long.
IF LEN(PROGDEST$) > 23 THEN
ReplaceListItem DRIVETEXT$, 7, MID$(PROGDEST$, 1, 23)+"..."
ELSE
ReplaceListItem DRIVETEXT$, 7, PROGDEST$
END IF
''Recalc if path changed.
IF (olddest$ <> PROGDEST$) AND (olddest$ <> PROGDEST$+"\") AND (olddest$+"\" <> PROGDEST$) 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
GETDPATH:
SetSymbolValue "EditTextIn", ARCDEST$
SetSymbolValue "EditFocus", "END"
GETDPATHL1:
sz$ = UIStartDlg(CUIDLL$, ASKDATAPATH, "FEditDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
olddest$ = ARCDEST$
ARCDEST$ = GetSymbolValue("EditTextOut")
''Validate new path.
IF IsDirWritable(ARCDEST$) = 0 THEN
GOSUB BADPATH
ARCDEST$ = olddest$
GOTO GETDPATHL1
END IF
UIPop 1
''Truncate display if too long.
IF LEN(ARCDEST$) > 23 THEN
ReplaceListItem DRIVETEXT$, 8, MID$(ARCDEST$, 1, 23)+"..."
ELSE
ReplaceListItem DRIVETEXT$, 8, ARCDEST$
END IF
''Recalc if path changed.
IF (olddest$ <> ARCDEST$) AND (olddest$ <> ARCDEST$+"\") AND (olddest$+"\" <> ARCDEST$) THEN
SetDriveStatus
END IF
olddest$ = ""
GOTO CUSTINST
ELSEIF sz$ = "REACTIVATE" THEN
SetDriveStatus
GOTO GETDPATHL1
ELSEIF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO GETDPATHL1
ELSE
UIPop 1
GOTO CUSTINST
END IF
TOOBIG:
sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
SetDriveStatus
GOTO TOOBIG
END IF
UIPop 1
RETURN
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
ASKOVERWRITE:
sz$ = UIStartDlg(CUIDLL$, ASKOVERWRITE, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "BACK" THEN
GOTO CUSTINST
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKOVERWRITE
ELSE
UIPop 1
END IF
RETURN
'' -------------------------------------- Upgrade -------------------------
UPGRADE:
SetDriveStatus
sz$ = UIStartDlg(CUIDLL$, CUSTUPGRADE, "FCustInstDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
''Install only if it will fit.
FOR i% = 1 TO 3 STEP 1
IF GetListItem(BIGLIST$, i%) <> "" THEN
GOSUB TOOBIG
GOTO UPGRADE
END IF
NEXT i%
UIPop 1
GOTO INSTALL
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO TYPEASK
ELSEIF sz$ = "PATH" THEN
GOTO GETUPATH
ELSEIF sz$ = "REACTIVATE" THEN
SetDriveStatus
GOTO UPGRADE
ELSE
GOSUB ASKQUIT
GOTO UPGRADE
END IF
GETUPATH:
SetSymbolValue "EditTextIn", PROGDEST$
SetSymbolValue "EditFocus", "END"
GETUPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
olddest$ = PROGDEST$
PROGDEST$ = GetSymbolValue("EditTextOut")
''Validate new path.
IF IsDirWritable(PROGDEST$) = 0 THEN
GOSUB BADPATH
PROGDEST$ = olddest$
GOTO GETUPATHL1
END IF
UIPop 1
''Truncate display if too long.
IF LEN(PROGDEST$) > 23 THEN
ReplaceListItem DRIVETEXT$, 7, MID$(PROGDEST$, 1, 23)+"..."
ELSE
ReplaceListItem DRIVETEXT$, 7, PROGDEST$
END IF
''Recalc if path changed.
IF (olddest$ <> PROGDEST$) AND (olddest$ <> PROGDEST$+"\") AND (olddest$+"\" <> PROGDEST$) THEN
SetDriveStatus
END IF
olddest$ = ""
GOTO UPGRADE
ELSEIF sz$ = "REACTIVATE" THEN
SetDriveStatus
GOTO GETUPATHL1
ELSEIF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO GETUPATHL1
ELSE
UIPop 1
GOTO UPGRADE
END IF
'' ----------------------------- SOWrkStn ------------------------------
WRKSTNASK:
'' Ask for Single User, Network or Workstation installation
sz$ = UIStartDlg(CUIDLL$, ASKWORKSTN, "FAskTypeDlgProc", APPHELP, HELPPROC$)
IF sz$ = "NETWORK" THEN
DBLIBTYPE$ = "NETWORK"
FullInst$ = "TRAVEL"
UIPop 1
GOTO WRKSTNINST
ELSEIF sz$ = "SINGLE" THEN
DBLIBTYPE$ = "NETWORK"
FullInst$ = "WRKSTN"
UIPop 1
GOTO DLLINST
ELSE
GOSUB ASKQUIT
GOTO WRKSTNASK
END IF
WRKSTNINST:
SetDriveStatus
sz$ = UIStartDlg(CUIDLL$, TRAVELINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
''Install only if it will fit.
FOR i% = 1 TO 3 STEP 1
IF GetListItem(BIGLIST$, i%) <> "" THEN
GOSUB TOOBIG
GOTO WRKSTNINST
END IF
NEXT i%
UIPop 1
GOTO WRKINSTALL
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WRKSTNASK
ELSEIF sz$ = "PATH" THEN
GOTO WRKPATH
ELSEIF sz$ = "DPATH" THEN
GOTO WRKDPATH
ELSEIF sz$ = "REACTIVATE" THEN
SetDriveStatus
GOTO WRKSTNINST
ELSE
GOSUB ASKQUIT
GOTO WRKSTNINST
END IF
WRKINSTALL:
BuildCopyList
CopyFilesInCopyList
ini$ = MakePath(PROGDEST$, "SuperOff.ini")
ServerIniFile$ = FindFileUsingFIleOpen(MakePath$(NetDir$, "SUPEROFF.INI"))
IF ServerIniFile$ = "" THEN
ErrorMsg(7)
ERR = 657
GOTO QUIT
END IF
CopyFile ServerIniFile$, ini$, cmoOverwrite, 0
CreateIniKeyValue ini$, "SuperOffice", "travel", "Yes" , cmoOverwrite
CreateIniKeyValue ini$, "SuperOffice", "local_archivepath", ARCDEST$ , cmoOverwrite
ini$ = MakePath$(GetWindowsDir, "wpc.ini")
CreateIniKeyValue ini$, "wpwp-3rd", "SuperWP", MakePath$(PROGDEST$, "SuperWP.dll") , cmoOverwrite
CreateProgmanGroup "SuperOffice", "", cmoNone
ShowProgmanGroup "SuperOffice", 1, cmoNone
CreateProgmanItem "SuperOffice", "SuperOffice", MakePath(PROGDEST$, "SUPEROFF.EXE"), "", cmoOverwrite
GOTO QUIT
DLLINST:
BuildCopyList
CopyFilesInCopyList
ini$ = MakePath$(GetWindowsDir, "wpc.ini")
CreateIniKeyValue ini$, "wpwp-3rd", "SuperWP", MakePath$(NetDir$, "SuperWP.dll") , cmoOverwrite
CreateProgmanGroup "SuperOffice", "", cmoNone
ShowProgmanGroup "SuperOffice", 1, cmoNone
CreateProgmanItem "SuperOffice", "SuperOffice", MakePath(NetDir$, "SUPEROFF.EXE"), "", cmoOverwrite
GOTO QUIT
WRKPATH:
SetSymbolValue "EditTextIn", PROGDEST$
SetSymbolValue "EditFocus", "END"
WRKPATHL1:
sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
olddest$ = PROGDEST$
PROGDEST$ = GetSymbolValue("EditTextOut")
''Validate new path.
IF IsDirWritable(PROGDEST$) = 0 OR IsDriveNetwork(MID$(PROGDEST$,1,1)) = 1 THEN
GOSUB BADPATH
PROGDEST$ = olddest$
GOTO WRKPATHL1
END IF
UIPop 1
''Truncate display if too long.
IF LEN(PROGDEST$) > 23 THEN
ReplaceListItem DRIVETEXT$, 7, MID$(PROGDEST$, 1, 23)+"..."
ELSE
ReplaceListItem DRIVETEXT$, 7, PROGDEST$
END IF
''Recalc if path changed.
IF (olddest$ <> PROGDEST$) AND (olddest$ <> PROGDEST$+"\") AND (olddest$+"\" <> PROGDEST$) THEN
SetDriveStatus
END IF
olddest$ = ""
GOTO WRKSTNINST
ELSEIF sz$ = "REACTIVATE" THEN
SetDriveStatus
GOTO WRKPATHL1
ELSEIF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO WRKPATHL1
ELSE
UIPop 1
GOTO WRKSTNINST
END IF
WRKDPATH:
SetSymbolValue "EditTextIn", ARCDEST$
SetSymbolValue "EditFocus", "END"
WRKDPATHL1:
sz$ = UIStartDlg(CUIDLL$, ASKDATAPATH, "FEditDlgProc", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
olddest$ = ARCDEST$
ARCDEST$ = GetSymbolValue("EditTextOut")
''Validate new path.
IF IsDirWritable(ARCDEST$) = 0 OR IsDriveNetwork(MID$(ARCDEST$,1,1)) = 1 THEN
GOSUB BADPATH
ARCDEST$ = olddest$
GOTO WRKDPATHL1
END IF
UIPop 1
''Truncate display if too long.
IF LEN(ARCDEST$) > 23 THEN
ReplaceListItem DRIVETEXT$, 8, MID$(ARCDEST$, 1, 23)+"..."
ELSE
ReplaceListItem DRIVETEXT$, 8, ARCDEST$
END IF
''Recalc if path changed.
IF (olddest$ <> ARCDEST$) AND (olddest$ <> ARCDEST$+"\") AND (olddest$+"\" <> ARCDEST$) THEN
SetDriveStatus
END IF
olddest$ = ""
GOTO WRKSTNINST
ELSEIF sz$ = "REACTIVATE" THEN
SetDriveStatus
GOTO WRKDPATHL1
ELSEIF sz$ = "EXIT" THEN
GOSUB ASKQUIT
GOTO WRKDPATHL1
ELSE
UIPop 1
GOTO WRKSTNINST
END IF
'**
'** Purpose:
'** Displays a dialog box with an error message
'** Returns:
'** none.
'*************************************************************************
SUB ErrorMsg(errnum%) STATIC
IF errnum% > 7 OR errnum < 1 THEN
errornum% = 200
END IF
ErrSrcDir$ = GetSymbolValue("STF_SRCDIR")
ErrorIni$ = MakePath(ErrSrcDir$, "Error.ini")
Msg$ = GetIniKeyString(ErrorIni$, "Error", STR$(errnum%))
i% = DoMsgBox(Msg$, "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END SUB
'**
'** Purpose:
'** Builds the install.ini file for document and application setup
'** Returns:
'** none.
'*************************************************************************
SUB WriteInstallIni STATIC
ini$ = MakePath(PROGDEST$, "SuperOff.ini")
CreateIniKeyValue ini$, "SuperOffice", "archivepath", ARCDEST$ , cmoOverwrite
ini$ = MakePath$(GetWindowsDir, "wpc.ini")
CreateIniKeyValue ini$, "wpwp-3rd", "SuperWP", MakePath$(PROGDEST$, "SuperWP.dll") , cmoOverwrite
CreateProgmanGroup "SuperOffice", "", cmoNone
ShowProgmanGroup "SuperOffice", 1, cmoNone
CreateProgmanItem "SuperOffice", "SuperOffice", MakePath(PROGDEST$, "SUPEROFF.EXE"), "", cmoOverwrite
WPAPP$ = GetListItem(DRIVETEXT$, 9)
WPSECT$ = WPAPP$
'' No need to change application name when Ami Pro
IF WPAPP$ = "Microsoft Word" THEN
WPAPP$ = "MS Word"
ELSEIF WPAPP$ = "WordPerfect" THEN
WPAPP$ = "WP Win"
ELSEIF WPAPP$ = "Windows Write" THEN
WPAPP$ = "Write"
ELSEIF WPAPP$ = "Other Word Processor" THEN
WPAPP$ = "Write"
END IF
SSAPP$ = GetListItem(DRIVETEXT$, 10)
SSSECT$ = SSAPP$
IF SSAPP$ = "Microsoft Excel" THEN
SSAPP$ = "MS Excel"
ELSEIF SSAPP$ = "Lotus 1-2-3" THEN
SSAPP$ = "Lotus 123"
ELSEIF SSAPP$ = "Other Spreadsheet" THEN
SSAPP$ = "Write"
END IF
ini$ = MakePath(PROGDEST$, "Install.ini")
CreateIniKeyValue ini$, "SuperOffice", "application:1", WPAPP$ , cmoOverwrite
CreateIniKeyValue ini$, "SuperOffice", "application:2", SSAPP$ , cmoOverwrite
'' Letter1
KEY$ = """L1"""
LISTSTRING$ = GetIniKeyString(szInf$, WPSECT$, KEY$)
APP$ = "1," + WPAPP$
IF LISTSTRING$ = "" THEN
LISTSTRING$ = GetIniKeyString(szInf$, SSSECT$, KEY$)
APP$ = "2," + SSAPP$
END IF
IF LISTSTRING$ <> "" THEN
TEMPLATESTRING$ = GetIniKeyString(szInf$, "Template Names", KEY$)
FileName$ = GetNthFieldFromIniString(LISTSTRING$, 2)
CreateIniKeyValue ini$, "SuperOffice", "letter:" + TEMPLATESTRING$, FileName$ + "," + APP$ , cmoNone
END IF
'' Letter2
KEY$ = """L2"""
LISTSTRING$ = GetIniKeyString(szInf$, WPSECT$, KEY$)
APP$ = "1," + WPAPP$
IF LISTSTRING$ = "" THEN
LISTSTRING$ = GetIniKeyString(szInf$, SSSECT$, KEY$)
APP$ = "2," + SSAPP$
END IF
IF LISTSTRING$ <> "" THEN
TEMPLATESTRING$ = GetIniKeyString(szInf$, "Template Names", KEY$)
FileName$ = GetNthFieldFromIniString(LISTSTRING$, 2)
CreateIniKeyValue ini$, "SuperOffice", "letter:" + TEMPLATESTRING$, FileName$ + "," + APP$ , cmoNone
END IF
'' Fax1
KEY$ = """F1"""
LISTSTRING$ = GetIniKeyString(szInf$, WPSECT$, KEY$)
APP$ = "1," + WPAPP$
IF LISTSTRING$ = "" THEN
LISTSTRING$ = GetIniKeyString(szInf$, SSSECT$, KEY$)
APP$ = "2," + SSAPP$
END IF
IF LISTSTRING$ <> "" THEN
TEMPLATESTRING$ = GetIniKeyString(szInf$, "Template Names", KEY$)
FileName$ = GetNthFieldFromIniString(LISTSTRING$, 2)
CreateIniKeyValue ini$, "SuperOffice", "fax:" + TEMPLATESTRING$, FileName$ + "," + APP$ , cmoNone
END IF
'' Fax2
KEY$ = """F2"""
LISTSTRING$ = GetIniKeyString(szInf$, WPSECT$, KEY$)
APP$ = "1," + WPAPP$
IF LISTSTRING$ = "" THEN
LISTSTRING$ = GetIniKeyString(szInf$, SSSECT$, KEY$)
APP$ = "2," + SSAPP$
END IF
IF LISTSTRING$ <> "" THEN
TEMPLATESTRING$ = GetIniKeyString(szInf$, "Template Names", KEY$)
FileName$ = GetNthFieldFromIniString(LISTSTRING$, 2)
CreateIniKeyValue ini$, "SuperOffice", "fax:" + TEMPLATESTRING$, FileName$ + "," + APP$ , cmoNone
END IF
END SUB
'**
'** Purpose:
'** Builds the list of files to copy depending on selected templates etc.
'** Returns:
'** none.
'*************************************************************************
SUB BuildCopyList STATIC
ClearCopyList
IF FullInst$ = "TRAVEL" OR FullInst$ = "WRKSTN" THEN
IF FullInst$ = "TRAVEL" THEN
AddSectionFilesToCopyList "AppFiles", NetDir$, PROGDEST$
AddSectionFilesToCopyList "DBLibNetwork", NetDir$, PROGDEST$
END IF
'' Do not copy DLL files to Windows system directory if a network directory
IF IsDriveNetwork(MID$(GetWindowsSysDir, 1, 1)) = 0 THEN
AddSectionFilesToCopyList "DLLShared", SrcDir$, GetWindowsSysDir
AddSectionFilesToCopyList "DLLShared2", SrcDir$, GetWindowsSysDir
END IF
ELSE
AddSectionFilesToCopyList "AppFiles", MakePath$(SrcDir$, "SUPEROFF"), PROGDEST$
AddSectionFilesToCopyList "AppFiles2", MakePath$(SrcDir$, "SUPEROFF"), PROGDEST$
IF DBLIBTYPE$ = "SINGLE" THEN
AddSectionFilesToCopyList "DBLibSingle", MakePath$(SrcDir$, "SUPEROFF"), PROGDEST$
ELSE
AddSectionFilesToCopyList "DBLibNetwork", MakePath$(SrcDir$, "SUPEROFF"), PROGDEST$
'' Add Workstation installation
AddSectionFilesToCopyList "SuperOffice Workstation", SrcDir$, MakePath$(PROGDEST$, "SOWRKSTN")
END IF
IF FullInst$ = "ON" THEN
AddSectionFilesToCopyList "DataFiles", MakePath$(SrcDir$, "SO_ARC\DATA"), MakePath(ARCDEST$, DATAD$)
SECTION$ = GetListItem(DRIVETEXT$, 9)
AddSectionFilesToCopyList SECTION$, MakePath$(SrcDir$, "SO_ARC\TEMPLATE"), MakePath(ARCDEST$, TEMPLATED$)
SECTION$ = GetListItem(DRIVETEXT$, 10)
AddSectionFilesToCopyList SECTION$, MakePath$(SrcDir$, "SO_ARC\TEMPLATE"), MakePath(ARCDEST$, TEMPLATED$)
'' Add files for demo version OK if empty
AddSectionFilesToCopyList "Demo", SrcDir$, ARCDEST$
END IF
IF IsDriveNetwork(MID$(GetWindowsSysDir, 1, 1)) = 0 THEN
AddSectionFilesToCopyList "DLLShared", SrcDir$, GetWindowsSysDir
AddSectionFilesToCopyList "DLLShared2", MakePath$(SrcDir$, "SOWRKSTN"), GetWindowsSysDir
END IF
END IF
END SUB
'**
'** Purpose:
'** Recalculates disk space for the given option files and sets
'** the status info symbol "StatusItemsText".
'** Arguments:
'** ftype% - type of files to add, one of the following:
'** DATAFILES, OPTFILES1
'** Returns:
'** none.
'*************************************************************************
SUB RecalcFiles (ftype%) STATIC
CursorSave% = ShowWaitCursor()
BuildCopyList
fExtra% = 0
ListSym$ = APPNEEDS$
''Add extra cost to Windows drive for ini/progman, etc.
ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
fExtra% = 1
StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
cost& = 0
FOR i% = 1 TO 26 STEP 1
cost& = cost& + VAL(GetListItem(ListSym$, i%))
NEXT i%
ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
IF StillNeed& > 0 THEN
ReplaceListItem BIGLIST$, ftype%, "YES"
ELSE
ReplaceListItem BIGLIST$, ftype%, ""
END IF
IF fExtra% THEN
ReplaceListItem EXTRACOSTS$, ndrive%, "0"
END IF
RestoreCursor CursorSave%
ListSym$ = ""
END SUB
'**
'** Purpose:
'** Recalculates disk space and sets option status info according
'** to the current destination path.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB RecalcPath STATIC
CursorSave% = ShowWaitCursor()
RecalcFiles DATAFILES
RestoreCursor CursorSave%
END SUB
'**
'** Purpose:
'** Sets drive status info according to latest disk space calcs.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB SetDriveStatus STATIC
RecalcPath
drive$ = MID$(PROGDEST$, 1, 1)
ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
ddrive$ = MID$(ARCDEST$, 1, 1)
cost& = VAL(GetListItem(APPNEEDS$, ndrive%))
free& = GetFreeSpaceForDrive(drive$)
ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
IF free& < cost& THEN
ReplaceListItem BIGLIST$, 1, "YES"
ELSE
ReplaceListItem BIGLIST$, 1, ""
END IF
IF drive$ = ddrive$ THEN
ReplaceListItem DRIVETEXT$, 4, ""
ReplaceListItem DRIVETEXT$, 5, ""
ReplaceListItem DRIVETEXT$, 6, ""
ELSE
ndrive% = ASC(ucase$(ddrive$)) - ASC("A") + 1
cost& = VAL(GetListItem(APPNEEDS$, ndrive%))
free& = GetFreeSpaceForDrive(ddrive$)
ReplaceListItem DRIVETEXT$, 4, ddrive$ + ":"
ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
IF free& < cost& THEN
ReplaceListItem BIGLIST$, 2, "YES"
ELSE
ReplaceListItem BIGLIST$, 2, ""
END IF
END IF
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