home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1996 July
/
VPR9607B.BIN
/
driver
/
hp
/
win31
/
pp101
/
disk1
/
scanner.ms_
/
scanner.ms
Wrap
Text File
|
1994-10-20
|
34KB
|
1,287 lines
'**************************************************************************
'* HP Scanner Setup
'**************************************************************************
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'ds2util.inc'
'$INCLUDE 'msdetect.inc'
''Constants taken from windows.h (SDK version 3.1)
CONST WS_VISIBLE = &H10000000
CONST WS_BORDER = &H00800000
CONST WS_CLIPCHILDREN = &H02000000
CONST GWL_STYLE = -16
CONST SW_SHOWMAXIMIZED = 3
''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 APPHELP1 = 901
CONST APPHELP2 = 902
CONST APPHELP3 = 903
CONST APPHELP4 = 904
CONST APPHELP5 = 905
CONST APPHELP6 = 906
CONST APPHELP7 = 907
CONST OLDDRIVEROPTION = 1000
CONST MODIFYCONFIG = 1010
CONST MODIFYSYSTEMINI = 1020
CONST INSERTREF = 1050
CONST MODIFYPATH = 1030
CONST SINGLELIST = 1900
CONST GROUPLIST = 2000
CONST CARDOPTIONS = 2010
CONST CARDNOTE = 2015
CONST ERRORSPACE = 2030
CONST EXITSUCCESSASPI = 2035
CONST IDC_CURSOR1 = 2040
CONST ERRORCARD = 2050
CONST PRINTERSELECT = 2060
CONST SCREENCALIBRATION = 2070
CONST CUSTINST2 = 2080
CONST EXITSUCCESSREBOOT = 2090
CONST CHECK = 2500
CONST CUSTINST = 6200
CONST BADPATH = 6400
CONST CDCONFIRMINFO = 7300
CONST ERR_WINDOWSVERSION = 8000
CONST ERR_WINDOWSMODE = 8001
CONST STR_OPTIONALSCSICARD = 8002
CONST STR_DIR = 8003
CONST STR_PROGMANGROUP = 8004
CONST STR_SCANNER = 8005
CONST STR_INTERFACECARD = 8006
CONST ERR_CORRUPTSOURCES = 8007
CONST STR_HPPICTUREPLACE = 8008
CONST STR_HPCOPIER = 8009
CONST STR_SCSIADDRESS = 8010
CONST STR_SCANNERTEST = 8011
CONST STR_READMETXT = 8012
CONST STR_SJPLUSCARD = 8013
CONST STR_GROUPSTRING = 8014
CONST STR_HPSCREENCALIBRATION = 8015
CONST STR_SETUP = 8016
CONST STR_TITLE = 8017
CONST STR_HPINTERFACECARD = 8018
CONST STR_ABOUT1 = 8019
CONST STR_ABOUT2 = 8020
CONST ERR_PORT = 8000
''Bitmap ID
CONST LOGO = 1
GLOBAL ExtraCosts$ ''List of extra costs to add per drive.
GLOBAL CostPerDisk$
GLOBAL DestCost&
GLOBAL WinCost&
GLOBAL DestFree&
GLOBAL WinFree&
GLOBAL DriversList$
GLOBAL ASPIFound%
GLOBAL CAMFound%
GLOBAL WinMajVer%
GLOBAL WinMinVer%
GLOBAL WinMode%
GLOBAL WinDir$ ''Windows directory.
GLOBAL TwainDir$ ''Directory for the Twain DSM.
GLOBAL DEST$ ''Default destination directory.
GLOBAL OptScanner(2) AS STRING ''Scanner installation option.
GLOBAL ScannerPick$ ''Text for 'ScannerChoice'.
GLOBAL ScannerChoice% '' 1 for ScanJetII family,
'' 2 for ScanJet Plus,
GLOBAL AskModSysIni%
GLOBAL UsingOldDriver%
GLOBAL ConfigFile$
GLOBAL OPTSETUP$ ''Setup type option selection.
GLOBAL OPTCard$ ''Option to use existing card.
GLOBAL OPTCardText(3) AS STRING ''Text for selected card option.
GLOBAL DEFAULTGROUP$ ''Default group name.
GLOBAL GROUP$ ''Selected group name.
GLOBAL SystemArchitecture$ ''Detected architecture.
GLOBAL LISTMADE% ''True if group names list has been
'' made, False otherwise.
GLOBAL DS2Cui$
DECLARE SUB Install
DECLARE SUB CalcCopyCost
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
INIT:
ON ERROR GOTO ErrorHandler
DS2Cui$ = "ds2cui.dll" ''Custom UI stuff for DS2
About1$ = STRING$(128,32)
i% = AcquireString(STR_ABOUT1, About1$, 128)
About2$ = STRING$(128,32)
i% = AcquireString(STR_ABOUT2, About2$, 128)
SetAbout About1$, About2$
'' Verify Windows version and mode.
'' Windows ver. 3.x and Windows NT.
WinMajVer% = GetWindowsMajorVersion()
WinMinVer% = GetWindowsMinorVersion()
'' Set the costs list values
CostPerDisk$ = "CostPerDisk"
ExtraCosts$ = "ExtraCosts"
'' set drive c costs (for config.hp)
AddListItem ExtraCosts$, "2048"
AddListItem CostPerDisk$, "0"
'' set other drive costs
FOR i% = 2 TO 26 STEP 1
AddListItem ExtraCosts$, "0"
AddListItem CostPerDisk$, "0"
NEXT i%
Setup$ = STRING$(128,32)
i% = AcquireString(STR_SETUP, Setup$, 128)
IF (WinMajVer% < 3) OR ((WinMajVer% = 3) AND (WinMinVer% < 1)) THEN
errStr$ = STRING$(128,32)
i% = AcquireString(ERR_WINDOWSVERSION, errStr$, 128)
i% = DoMsgBox(errStr$, Setup$, MB_TASKMODAL+MB_ICONHAND+MB_OK)
dlg% = EXITFAILURE
GOTO QUITL1
END IF
WinMode% = GetWindowsMode()
IF WinMode% = 0 THEN
errStr$ = STRING$(128,32)
i% = AcquireString(ERR_WINDOWSMODE, errStr$, 128)
i% = DoMsgBox(errStr$, Setup$, MB_TASKMODAL+MB_ICONHAND+MB_OK)
dlg% = EXITFAILURE
GOTO QUITL1
END IF
'' Display main window frame maximized.
hWnd% = HwndFrame()
j% = MoveWindow(hWnd%, 0, 0, GetScreenWidth(), GetScreenHeight(), 0)
AddListItem "SettingsTextIn", DEST$
AddListItem "SettingsTextIn", GROUP$
'' AddListItem "SettingsTextIn", OptScanner(0)
AddListItem "SettingsTextIn", OPTCardText(0)
AddListItem "DiskSpaceData", MID$(DEST$, 1, 2)
AddListItem "DiskSpaceData", ""
AddListItem "DiskSpaceData", ""
AddListItem "DiskSpaceData", MID$(WinDir$, 1, 2)
AddListItem "DiskSpaceData", ""
AddListItem "DiskSpaceData", ""
'' Create place holders for setup information that will be displayed
'' in a "ConfirmInfo" dialog. One "AddListItem" is needed for each
'' piece of data that will be displayed. The NULLs will be replaced
'' based on information entered by the user.
AddListItem "ConfirmTextIn", ""
AddListItem "ConfirmTextIn", ""
AddListItem "ConfirmTextIn", ""
AddListItem "ConfirmTextIn", ""
AddListItem "ConfirmTextIn", ""
AddListItem "ConfirmTextIn", ""
xxxStr$ = STRING$(128,32)
i% = AcquireString(STR_HPINTERFACE, xxxStr$, 128)
OptScanner(0) = "ScanJet IIp, IIc, IIcx, 3p "
OptScanner(1) = "ScanJet Plus "
ScannerPick$ = OptScanner(0)
SystemArchitecture$ = "ISA"
DriversList$ = "SJDrivers"
AddListItem DriversList$, "SJDRIVER.SYS"
AddListItem DriversList$, "MINI400I.SYS"
AddListItem DriversList$, "SJIIX.SYS"
AddListItem DriversList$, "SJII.SYS"
SetSymbolValue "SJIIDriverFound", "0"
SetSymbolValue "WIN30VxD", "WIN400OI.386"
SetSymbolValue "WIN31VxD", "WIN400I.386"
SetSymbolValue "ScannerVxD", "HPSCANR.386"
'' set the default installation (nothing)
SetSymbolValue "DriverInstalled", "0"
WinDir$ = GetWindowsDir()
SetSymbolValue "ConfigTemp", "C:\CONFIG.TMP"
SetSymbolValue "AutoexecTemp", "C:\AUTOEXEC.TMP"
SetSymbolValue "SysIniTemp", WinDir$+"SYSTEM.TMP"
SetSymbolValue "ConfigBackup", "C:\CONFIG.HP"
SetSymbolValue "AutoexecBackup", "C:\AUTOEXEC.HP"
SetSymbolValue "SysIniBackup", WinDir$+"SYSTEM.HP"
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
HELP1PROC$ = "FHelp1DlgProc" ''Help dialog procedure
HELP2PROC$ = "FHelp2DLgProc" ''Help dialog procedure
HELP3PROC$ = "FHelp3DLgProc" ''Help dialog procedure
HELP4PROC$ = "FHelp4DlgProc" ''Help dialog procedure
HELP5PROC$ = "FHelp5DlgProc" ''Help dialog procedure
HELP6PROC$ = "FHelp6DlgProc" ''Help dialog procedure
HELP7PROC$ = "FHelp7DlgProc" ''Help dialog procedure
SetBitmap DS2Cui$, LOGO
Title$ = STRING$(128,32)
i% = AcquireString(STR_TITLE, Title$, 128)
SetTitle Title$
'' SetTitle "HP ScanJet Setup"
'' Get the directory where the setup files are and read the
'' .inf file.
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "SCANNER.INF"
END IF
ReadInfFile szInf$
groupStr$ = STRING$(256,32)
i% = AcquireString(STR_GROUPSTRING, groupStr$, 256)
DEFAULTGROUP$ = STRING$(256,32)
GROUP$ = STRING$(256,32)
DEFAULTGROUP$ = groupStr$
GROUP$ = DEFAULTGROUP$
LISTMADE% = 0
OPTSETUP$ = "1"
OPTCard$ = "1"
SetSymbolValue "OPTCard", OPTCard$
cardStr$ = STRING$(128,32)
i% = AcquireString(STR_HPINTERFACECARD, cardStr$, 128)
OPTCardText(0) = cardStr$
i% = AcquireString(STR_OPTIONALSCSICARD, cardStr$, 128)
OPTCardText(1) = cardStr$
i% = AcquireString(STR_SJPLUSCARD, cardStr$, 128)
OPTCardText(2) = cardStr$
ASPIFound% = 0
DEST$ = "C:\SCANJET"
SetSymbolValue "InstallDir", DEST$
TwainDir$ = WinDir$ + "TWAIN\"
SetSymbolValue "TwainDir", TwainDir$
SetSymbolValue "WinDir", WinDir$
DestCost& = 0
WinCost& = 0
DestFree& = 0
WinFree& = 0
'' Build the (default) copy list and compute the copy cost.
CalcCopyCost
'$IFDEF DEBUG
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
'$ENDIF ''DEBUG
WELCOME:
sz$ = UIStartDlg(DS2Cui$, WELCOME, "FInfoDlgProc", APPHELP6, HELP6PROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO WELCOME
ELSE
UIPop 1
GOSUB ASKQUIT
GOTO WELCOME
END IF
'' Get information about the system.
IF IsItEISA = 1 THEN
SystemArchitecture$ = "EISA"
SetSymbolValue "SystemArchitecture", "Extended Industry Standard Architecture (EISA)"
'' i% = DoMsgBox("SetUp has detected an EISA system.", "SetUp", MB_TASKMODAL+MB_OK)
ELSEIF IsItMCA = 2 THEN
SystemArchitecture$ = "MCA"
SetSymbolValue "SystemArchitecture", "MicroChannel Architecture (MCA)"
'' i% = DoMsgBox("SetUp has detected an MCA system.", "SetUp", MB_TASKMODAL+MB_OK)
ELSE
SystemArchitecture$ = "ISA"
SetSymbolValue "SystemArchitecture", "AT Backplane"
'' i% = DoMsgBox("SetUp has detected an ISA system.", "SetUp", MB_TASKMODAL+MB_OK)
END IF
'' IF (IsItNT()) THEN
''i% = DoMsgBox("SetUp has detected an NT system.", "SetUp", MB_TASKMODAL+MB_OK)
'' ENDIF
ASPIFound% = FindASPI
CAMFound% = FindCAM
'' Select which scanner(s) is/are being installed.
CHOOSESCANNER:
ScannerPick$ = ""
ScannerChoice% = 0
CHOOSESCANNERL1:
''x sz$ = UIStartDlg(DS2Cui$, OPTIONS, "FRadioDlgProc", APPHELP1, HELP1PROC$)
''x szChoice$ = GetSymbolValue("ButtonChecked")
''x
''x IF (szChoice$ = "1") THEN
ScannerChoice% = 1
''x ELSE
''x ScannerChoice% = 2
''x ENDIF
ScannerPick$ = OptScanner(ScannerChoice% - 1)
''x IF sz$ = "CONTINUE" THEN
''x UIPop(1)
''x ELSEIF sz$ = "REACTIVATE" THEN
''x GOTO CHOOSESCANNERL1
''x ELSEIF sz$ = "BACK" THEN
''x UIPop 1
''x GOTO GETPATH
''x ELSE
''x GOSUB ASKQUIT
''x GOTO CHOOSESCANNER
''x END IF
'' Verify that an ASPI manager is in memory. If one is found then
'' give user option to use it or not.
''x IF (ASPIFound% = 1 OR CAMFound% = 1) THEN
''x IF (IsDriverInConfig(GetListItem(DriversList$, 2)) = 1) THEN
''x GOTO GETGROUPNAME
''x ENDIF
''x
''x'' i% = DoMsgBox("SetUp has detected a SCSI manager.", "SetUp", MB_TASKMODAL+MB_OK)
''x GOTO CARDOPTION
''x ELSE
''x GOTO GETGROUPNAME
''x ENDIF
'' Option to use an existing SCSI card. Assumes that the
'' ASPI or CAM manager for the card is already loaded.
OPTION:
'' Simple or Custom Setup options
'' SetSymbolValue "RadioDefault", OPTSETUP$
SetSymbolValue "SettingsTextIn", ""
AddListItem "SettingsTextIn", DEST$
AddListItem "SettingsTextIn", GROUP$
AddListItem "SettingsTextIn", OPTCardText(VAL(OPTCard)-1)
SetSymbolValue "DiskSpaceData", ""
AddListItem "DiskSpaceData", MID$(DEST$, 1, 2)
AddListItem "DiskSpaceData", ""
AddListItem "DiskSpaceData", ""
AddListItem "DiskSpaceData", MID$(WinDir$, 1, 2)
AddListItem "DiskSpaceData", ""
AddListItem "DiskSpaceData", ""
'' Build the (default) copy list and compute the copy cost.
CalcCopyCost
OPTL1:
sz$ = UIStartDlg(DS2Cui$, CUSTINST, "FCustomOptDlgProc", APPHELP2, HELP2PROC$)
OPTSETUP$ = GetSymbolValue("ButtonChecked")
UIPop(1)
IF sz$ = "CONTINUE" THEN
OPTSETUP$ = "1"
ELSEIF sz$ = "REACTIVATE" THEN
GOTO OPTL1
ELSEIF sz$ = "CUSTOM" THEN
OPTSETUP$ = "2"
ELSE
UIPop 1
GOSUB ASKQUIT
GOTO OPTION
END IF
'' for the quick path, we still need to check disk space
IF (OPTSETUP$ = "1") THEN
IF DestFree& < DestCost& THEN
sz$ = UIStartDlg(DS2Cui$, ERRORSPACE, "FDiskErrorDlgProc", APPHELP1, HELP1PROC$)
UIPop 2
GOTO GETPATH
ELSE
UIPop 1
END IF
GOTO STARTINSTALL
END IF
GETPATH:
SetSymbolValue "EditTextIn", DEST$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(DS2Cui$, DESTPATH, "FEditDlgProc", APPHELP3, HELP3PROC$)
DEST$ = LTRIM$( RTRIM$(GetSymbolValue("EditTextOut")))
IF MID$(DEST$, LEN(DEST$), 1) = "\" THEN
DEST$ = MID$( DEST$, 1, LEN(DEST$)-1 )
END IF
SetSymbolValue "InstallDir", DEST$
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DEST$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO OPTION
ELSE
UIPop 1
GOSUB ASKQUIT
GOTO GETPATH
END IF
'' Build the (new) copy list and compute the copy cost.
CalcCopyCost
TESTSPACE:
IF (DestFree& < DestCost&) THEN
sz$ = UIStartDlg(DS2Cui$, ERRORSPACE, "FDiskErrorDlgProc", APPHELP1, HELP1PROC$)
UIPop 2
GOTO GETPATH
ELSEIF sz$ = "REACTIVATE" THEN
GOTO TESTSPACE
ELSE
UIPop 1
END IF
'' if we are on an express setup and did the destination because of disk space prob,
'' then we need to go do the installation.
IF OPTSETUP$ = "1" THEN
GOTO STARTINSTALL
END IF
GETGROUPNAME:
IF LISTMADE% = 0 THEN
AddListItem "ListGroupsIn", GROUP$
LISTMADE% = 1
ENDIF
SetSymbolValue "ListGroupsOut", GROUP$
GETGROUPNAMEL1:
sz$ = UIStartDlg(DS2Cui$, GROUPLIST, "FGroupsDlgProc", APPHELP4, HELP4PROC$)
GROUP$ = GetSymbolValue("EditGroupOut")
''i% = DoMsgBox(GROUP$,"Verify Info", MB_TASKMODAL+MB_OK)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETGROUPNAMEL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO GETPATH
ELSE
UIPop 1
GOSUB ASKQUIT
GOTO GETGROUPNAME
END IF
CARDOPTION:
'' This option is not available with a ScanJet Plus.
''x IF (ScannerChoice% = 2) THEN
''x OPTCard$ = "3"
''x SetSymbolValue "OPTCard", OPTCard$
''x GOTO GETGROUPNAME
''x ENDIF
SetSymbolValue "RadioDefault", OPTCard$
CARDOPTIONL1:
sz$ = UIStartDlg(DS2Cui$, CARDOPTIONS, "FCardOptDlgProc", APPHELP5, HELP5PROC$)
OPTCard$ = GetSymbolValue("ButtonChecked")
SetSymbolValue "OPTCard", OPTCard$
''set the default symbol value in case the user doesn't allow config.sys to be modified
IF OPTCard = "1" THEN
SetSymbolValue "DriverInstalled", "4"
ELSEIF OPTCard = "2" THEN
SetSymbolValue "DriverInstalled", "5"
END IF
IF sz$ = "CONTINUE" THEN
UIPop(1)
ELSEIF sz$ = "REACTIVATE" THEN
GOTO CARDOPTIONL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO GETGROUPNAME
ELSE
UIPop 1
GOSUB ASKQUIT
GOTO CARDOPTION
END IF
CONFIRMINFO:
genericStr$ = STRING$(128,32)
i% = AcquireString(STR_DIR, genericStr$, 128)
ReplaceListItem "ConfirmTextIn", 1, genericStr$+" : "+DEST$
i% = AcquireString(STR_PROGMANGROUP, genericStr$, 128)
ReplaceListItem "ConfirmTextIn", 2, genericStr$+" : "+GROUP$
''x i% = AcquireString(STR_SCANNER, genericStr$, 128)
''x ReplaceListItem "ConfirmTextIn", 3, genericStr$+" : "+ScannerPick$
i% = AcquireString(STR_INTERFACECARD, genericStr$, 128)
IF OPTCard = "1" THEN
ReplaceListItem "ConfirmTextIn", 3, genericStr$+" : "+OPTCardText(0)
ELSEIF OPTCard = "2" THEN
ReplaceListItem "ConfirmTextIn", 3, genericStr$+" : "+OPTCardText(1)
ELSE
ReplaceListItem "ConfirmTextIn", 3, genericStr$+" : "+OPTCardText(0)
END IF
sz$ = UIStartDlg(DS2Cui$, CDCONFIRMINFO, "FConfirmDlgProc", APPHELP1, HELP1PROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO CONFIRMINFO
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO OPTION
END IF
STARTINSTALL:
'' Begin installation
Install
PRINTERSELECT:
SetSymbolValue "SlimINIPath", MakePath(DEST$, "hppscan.ini")
PRINTERSELECTL1:
sz$ = UIStartDlg(DS2Cui$, PRINTERSELECT, "FPrintersDlgProc", APPHELP4, HELP4PROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO PRINTERSELECTL1
ELSE
UIPop 1
GOSUB ASKQUIT
GOTO PRINTERSELECT
END IF
SCREENCAL:
SCREENCAL1:
sz$ = UIStartDlg(DS2Cui$, SCREENCALIBRATION, "FInfoDlgProc", APPHELP1, HELP1PROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO SCREENCAL1
ELSE
UIPop 1
GOSUB ASKQUIT
GOTO WELCOME
END IF
'' Run the screen calibration program in it's directory
CurrentDir$ = CURDIR$
CHDRIVE DEST$
CHDIR DEST$
RUN "screen.exe"
CHDRIVE CurrentDir$
CHDIR CurrentDir$
QUIT:
ON ERROR GOTO ERRQUIT
dlg% = 0
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(DS2Cui$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
ALL_DONE:
'' Check to see if README.TXT ever got copied,
'' if not don't bother trying to show it
CurrentDir$ = CURDIR$
d% = DoesDirExist( DEST$ )
IF d% = 1 THEN
CHDRIVE DEST$
CHDIR DEST$
readmeStr$ = STRING$(14,32)
i% = AcquireString(STR_READMETXT, readmeStr$, 14)
f% = DoesFileExist( MakePath( DEST$, readmeStr$), femRead )
IF f% = 1 THEN
RUN "notepad.exe "+readmeStr$, NOWAIT
END IF
CHDRIVE CurrentDir$
CHDIR CurrentDir$
END IF
END '' This is an exit point for the script.
ERRORHANDLER:
IF ERR = STFQUIT THEN
GOTO QUIT
END IF
ERRHANDLER1:
'' See if the user wants to quit (exit)
sz$ = UIStartDlg(DS2Cui$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
dlg% = EXITQUIT
GOTO QUITL1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ERRHANDLER1
ELSE
UIPop 1
END IF
'' send it back to the next line
RESUME NEXT
'' (not an exit point)
ERRQUIT:
errStr$ = STRING$(200,32)
i% = AcquireString(ERR_CORRUPTSOURCES, errStr$, 200)
i% = DoMsgBox(errStr$, Setup$, MB_OK+MB_TASKMODAL+MB_ICONHAND)
END '' This is an exit point for the script.
BADPATH:
sz$ = UIStartDlg(DS2Cui$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(DS2Cui$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
'*************************************************************************
'**
'** Purpose:
'** Builds the copy list and computes the copy cost.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB CalcCopyCost STATIC
'' Start with a clean list.
ClearCopyList
SrcDir$ = GetSymbolValue("STF_SRCDIR")
'' AddSectionFilesToCopyList "Files", SrcDir$, DEST$
AddSectionFilesToCopyList "HP PicturePlace", SrcDir$, DEST$
AddSectionFilesToCopyList "Utility Files", SrcDir$, DEST$
AddSectionFilesToCopyList "Images", SrcDir$, DEST$+"\IMAGES\"
AddSectionFilesToCopyList "HP Copier", SrcDir$, DEST$
'' NOTE: we're not worrying about which scanner anymore
'' Select which "config" files need to be copied
IF SystemArchitecture$ = "EISA" THEN
'' IF ScannerChoice% = 1 THEN
'' AddSectionFilesToCopyList "ScanJet II family EISA", SrcDir$, DEST$
'' ELSEIF ScannerChoice% = 2 THEN
'' AddSectionFilesToCopyList "ScanJet Plus EISA", SrcDir$, DEST$
'' ELSE
AddSectionFilesToCopyList "ScanJet II family EISA", SrcDir$, DEST$
AddSectionFilesToCopyList "ScanJet Plus EISA", SrcDir$, DEST$
'' END IF
ELSEIF SystemArchitecture$ = "MCA" THEN
'' IF ScannerChoice% = 1 THEN
'' AddSectionFilesToCopyList "ScanJet II family MCA", SrcDir$, DEST$
'' ELSEIF ScannerChoice% = 2 THEN
'' AddSectionFilesToCopyList "ScanJet Plus MCA", SrcDir$, DEST$
'' ELSE
AddSectionFilesToCopyList "ScanJet II family MCA", SrcDir$, DEST$
AddSectionFilesToCopyList "ScanJet Plus MCA", SrcDir$, DEST$
'' END IF
END IF
'' choose between 'swtchset.exe' and 'sjswitch.exe'
'' IF ScannerChoice% = 1 THEN
'' AddSectionFilesToCopyList "ScanJet II family", SrcDir$, DEST$
'' ELSEIF ScannerChoice% = 2 THEN
'' AddSectionFilesToCopyList "ScanJet Plus", SrcDir$, DEST$
'' ELSE
AddSectionFilesToCopyList "ScanJet II family", SrcDir$, DEST$
AddSectionFilesToCopyList "ScanJet Plus", SrcDir$, DEST$
'' END IF
AddSectionFilesToCopyList "ScanJet Plus Drivers", SrcDir$, DEST$
AddSectionFilesToCopyList "Windows", SrcDir$, WinDir$
AddSectionFilesToCopyList "Windows:System", SrcDir$, WinDir$+"SYSTEM\"
AddSectionFilesToCopyList "Windows:Twain", SrcDir$, TwainDir$
''x Windows 3.0 no longer supported, so this section is now commented out
''x IF (WinMinVer% = 0) THEN
'' AddSectionFilesToCopyList "Windows 3.0 Drivers", SrcDir$, DEST$
''x IF (NOT DoesFileExist(WinDir$+"SYSTEM\COMMDLG.DLL", femExists)) AND (NOT DoesFileExist(WinDir$+"COMMDLG.DLL", femExists)) THEN
''x AddSectionFilesToCopyList "Windows 3.0 compat", SrcDir$, WinDir$+"SYSTEM\"
''x ENDIF
''x ELSE
AddSectionFilesToCopyList "Windows 3.1 Drivers", SrcDir$, DEST$
AddSectionFilesToCopyList "HP Windows Drivers", SrcDir$, DEST$
''x ENDIF
AddSectionFilesToCopyList "DOS Drivers", SrcDir$, DEST$
AddSectionFilesToCopyList "HP SCSI Driver", SrcDir$, DEST$
CostPerDisk$ = "CostPerDisk"
StillNeed& = GetCopyListCost(ExtraCosts$, CostPerDisk$,"")
DestCost& = 0
WinCost& = 0
cost& = 0
FOR i% = 1 to 26 STEP 1
cost& = VAL(GetListItem(CostPerDisk$, i%))
''k% = DoMsgBox("drive ("+CHR$(i% + ASC("A")-1)+") cost ("+str$(cost&)+").", "Copy Costs", MB_TASKMODAL+MB_OK)
NEXT i%
DestDrive$ = MID$(DEST$, 1, 1)
i% = ASC(ucase$(DestDrive$)) - ASC("A") + 1
DestCost& = VAL(GetListItem(CostPerDisk$, i%))
ReplaceListItem "DiskSpaceData", 1, " " + DestDrive$ + ":"
ReplaceListItem "DiskSpaceData", 2, STR$(DestCost& / 1024) + " K"
drive$ = MID$(DEST$, 1, 1)
DestFree& = GetFreeSpaceForDrive(drive$)
IF (DestFree& < 0) THEN
DestFree& = 0
ENDIF
ReplaceListItem "DiskSpaceData", 3, STR$(DestFree& / 1024) + " K"
WinDrive$ = MID$(WinDir$, 1, 1)
ndrive% = ASC(ucase$(WinDrive$)) - ASC("A") + 1
WinCost& = VAL(GetListItem(CostPerDisk$, ndrive%))
''i% = DoMsgBox("Windows drive ('"+str$(ndrive%)+"') index in list.", "Copy Costs", MB_TASKMODAL+MB_OK)
ReplaceListItem "DiskSpaceData", 5, STR$(WinCost& / 1024) + " K"
WinFree& = GetFreeSpaceForDrive(WinDrive$)
IF (WinFree& < 0) THEN
WinFree& = 0
ENDIF
ReplaceListItem "DiskSpaceData", 6, STR$(WinFree& / 1024) + " K"
CostPerDisk$ = ""
END SUB
'*************************************************************************
'**
'** Purpose:
'** Performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
CreateDir DEST$, cmoNone
CreateDir DEST$+"\IMAGES", cmoNone
'' OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
'' These next 2 lines for testing only
'' DumpCopyList MakePath(DEST$, "COPYLIST.TXT" )
'' i% = SetCopyMode(0)
CopyFilesInCopyList
'' Must put back the copy mode for CopyFile to work
'' i% = SetCopyMode(1)
'' Get rid of misplaced vbx files that mess up HPCopier and Screen
'' (Other progrmas, like shareware, often place these in the windows directory)
IF DoesFileExist( MakePath( WinDir$, "THREED.VBX" ), femExists ) THEN
RemoveFile MakePath( WinDir$, "THREED.VBX" ), cmoNone
END IF
IF DoesFileExist( MakePath( WinDir$, "ANIBUTON.VBX" ), femExists ) THEN
RemoveFile MakePath( WinDir$, "ANIBUTON.VBX" ), cmoNone
END IF
IF DoesFileExist( MakePath( WinDir$, "GAUGE.VBX" ), femExists ) THEN
RemoveFile MakePath( WinDir$, "GAUGE.VBX" ), cmoNone
END IF
IF DoesFileExist( MakePath( WinDir$, "INSTSCRL.VBX" ), femExists ) THEN
RemoveFile MakePath( WinDir$, "INSTSCRL.VBX" ), cmoNone
END IF
''i% = DoMsgBox("Create group "+GROUP$, "HP ScanJet II Setup", MB_TASKMODAL++MB_OK)
NameStr$ = STRING$(128,32)
'' THIS IS TO FIX A PROBLEM WITH GROUP NAMES LONGER THAN 24 CHARACTERS
'' SIDE EFFECT IS THAT THE USER MIGHT NOT SEE WHAT THEY WANTED
GROUP$ = MID$( GROUP$, 1, 24 )
CreateProgmanGroup GROUP$, "", cmoNone
ShowProgmanGroup GROUP$, 1, cmoNone
i% = AcquireString(STR_HPPICTUREPLACE, NameStr$, 128)
CreateProgManItem GROUP$, NameStr$, MakePath(DEST$, "hppplace.exe"), "", cmoOverwrite
i% = AcquireString(STR_HPCOPIER, NameStr$, 128)
CreateProgManItem GROUP$, NameStr$, MakePath(DEST$, "hpcopier.exe"), "", cmoOverwrite
i% = AcquireString(STR_HPSCREENCALIBRATION, NameStr$, 128)
CreateProgManItem GROUP$, NameStr$, MakePath(DEST$, "screen.exe"), "", cmoOverwrite
i% = AcquireString(STR_SCSIADDRESS, NameStr$, 128)
CreateProgManItem GROUP$, NameStr$, MakePath(DEST$, "scsiaddr.exe"), "", cmoOverwrite
i% = AcquireString(STR_SCANNERTEST, NameStr$, 128)
CreateProgManItem GROUP$, NameStr$, MakePath(DEST$, "scantest.exe"), "", cmoOverwrite
i% = AcquireString(STR_READMETXT, NameStr$, 128)
CreateProgManItem GROUP$, NameStr$, "notepad.exe " + MakePath(DEST$, NameStr), "", cmoOverwrite
'' CloseLogFile
'' lets get rid of any old FOLDER.THMs
i% = DoesFileExist( MakePath(DEST$, "FOLDER.THM"), remRead )
IF i% = 1 THEN
RemoveFile MakePath(DEST$, "FOLDER.THM"), cmoFORCE
END IF
i% = DoesFileExist("C:\FOLDER.THM", remRead)
IF i% = 1 THEN
RemoveFile "C:\FOLDER.THM", cmoFORCE
END IF
'' write the HPPS data source ini file
i% = WriteHPPSINI()
'' write the HPPPLACE.INI file
CreateIniKeyValue WinDir$+"HPPPLACE.INI", "Recent File List", "File1", lcase$(DEST$+"\IMAGES"), cmoAll
CreateIniKeyValue WinDir$+"HPPPLACE.INI", "Window Size", "X", "10", cmoAll
CreateIniKeyValue WinDir$+"HPPPLACE.INI", "Window Size", "Y", "10", cmoAll
CreateIniKeyValue WinDir$+"HPPPLACE.INI", "Window Size", "W", "620", cmoAll
CreateIniKeyValue WinDir$+"HPPPLACE.INI", "Window Size", "H", "460", cmoAll
'' set the default TWAIN data source to us!
CreateIniKeyValue "WIN.INI", "TWAIN", "DEFAULT SOURCE", MakePath(TwainDir$, "HPPS.DS"), cmoAll
AskModSysIni% = 0
UsingOldDriver% = 0 '' old SCSI Driver
'' i% = DoMsgBox(GetSymbolValue("ConfigBackup"), "SCANNER.MST - ConfigBackup", MB_TASKMODAL++MB_OK)
CONFIG:
CopyFile "C:\CONFIG.SYS", GetSymbolValue("ConfigBackup"), cmoOverwrite,0
sz$ = UIStartDlg(DS2Cui$, MODIFYCONFIG, "FModifyConfigDlgProc", APPHELP1, HELP1PROC$)
IF (sz$ = "CONTINUE") THEN '' 'Yes' using new driver...
UIPop 1
CopyFile GetSymbolValue("ConfigTemp"), "C:\CONFIG.SYS", cmoOverwrite,0
RemoveFile GetSymbolValue("ConfigTemp"), cmoNone
ELSEIF sz$ = "REACTIVATE" THEN
GOTO CONFIG
ELSE
UIPop 1
END IF
'' Test$ = GetSymbolValue("SJIIDriverFound")
'' IF (Test$ = "1") THEN
'' sz$ = UIStartDlg(DS2Cui$, OLDDRIVEROPTION, "FYesNoDlgProc", APPHELP1, HELP1PROC$)
'' UIPop 1
'' IF (sz$ = "CONTINUE") THEN '' 'Yes' using new driver...
'' CopyFile GetSymbolValue("ConfigTemp"), "C:\CONFIG.SYS", cmoOverwrite,0
'' RemoveFile GetSymbolValue("ConfigTemp"), cmoNone
'' AskModSysIni% = 1
'' ELSE '' 'No' not using new driver...
'' AskModSysIni% = 0
'' UsingOldDriver% = 1
'' ENDIF
'' ELSE
'' IF DoesFileExist(GetSymbolValue("ConfigTemp"), femExists) THEN
'' AskModSysIni% = 1
'' CopyFile GetSymbolValue("ConfigTemp"), "C:\CONFIG.SYS", cmoOverwrite,0
'' RemoveFile GetSymbolValue("ConfigTemp"), cmoNone
'' ELSE
'' i% = IsDriverInConfig(GetListItem(DriversList$,3))
'' IF (i%=1) THEN
'' AskModSysIni% = 1
'' ENDIF
'' ENDIF
'' ENDIF
''This is now commented out because it is no longer needed.
''ie> The path is not needed for TWAIN
'' sz$ = UIStartDlg(DS2Cui$, MODIFYPATH, "FYesNoDlgProc", APPHELP1, HELP1PROC$)
'' UIPop 1
'' IF sz$ = "CONTINUE" THEN
'' CopyFile "C:\AUTOEXEC.BAT", GetSymbolValue("AutoexecBackup"), cmoOverwrite,0
'' i% = ModifyAutoexec()
'' CopyFile GetSymbolValue("AutoexecTemp"), "C:\AUTOEXEC.BAT", cmoOverwrite,0
'' RemoveFile GetSymbolValue("AutoexecTemp"), cmoNone
'' ENDIF
SYSINI:
'' IF AskModSysIni% = 1 THEN
sz$ = UIStartDlg(DS2Cui$, MODIFYSYSTEMINI, "FYesNoDlgProc", APPHELP1, HELP1PROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
CopyFile WinDir$+"SYSTEM.INI", GetSymbolValue("SysIniBackup"), cmoOverwrite,0
i% = ModifySysIni()
RemoveFile WinDir$+"SYSTEM.INI", cmoNone
RenameFile GetSymbolValue("SysIniTemp"), "SYSTEM.INI"
ELSEIF sz$ = "REACTIVATE" THEN
GOTO SYSINI
ELSE
UIPop 1
ENDIF
'' ENDIF
''i% = DoMsgBox("System Architecture ('"+SystemArchitecture$+"')", "Ref Disk", MB_TASKMODAL+MB_OK)
'' Configuration file stuff ... do this last because it requires
'' removing the installation disk...
'' IF (SystemArchitecture$ = "MCA") AND (OPTCard = "1") THEN
'' IF (ScannerChoice% = 2) THEN
'' ConfigFile$ = "@601f.adf"
'' ELSE
'' IF (ScannerChoice% = 1 OR ScannerChoice% = 0) THEN
'' IF (UsingOldDriver% = 1) THEN
'' ConfigFile$ = "@621f.adf"
'' ELSE
'' ConfigFile$ = "@631f.adf"
'' ENDIF
'' ENDIF
'' ENDIF
'' ELSEIF (SystemArchitecture$ = "EISA") AND (OPTCard = "1") THEN
'' IF (ScannerChoice% = 2) THEN
'' ConfigFile$ = "!hwp1461.cfg"
'' ELSE
'' May be adding a new .cfg file for new card
'' IF (ScannerChoice% = 1 OR ScannerChoice% = 0) THEN
'' IF (AskModSysIni% = 0) THEN
'' ConfigFile$ = "!hwp2002.cfg"
'' ELSE
'' ConfigFile$ = "!hwp2080.cfg"
'' ENDIF
'' ENDIF
'' ENDIF
'' ELSE '' System Architecture is "ISA" or only 3rd party SCSI
'' GOTO DONE
'' ENDIF
''i% = DoMsgBox("File ('"+ConfigFile$+"')", "Ref Disk", MB_TASKMODAL+MB_OK)
'' This section is now based on what is now in the config.sys file,
'' not choices made, because some choices are now automatic in order
'' to fix a bad installation. (ie. We're not letting the user goof it up)
DriverInstalled$ = GetSymbolValue("DriverInstalled")
IF DriverInstalled$ = "0" OR DriverInstalled$ = "5" THEN
GOTO DONE
ENDIF
IF (SystemArchitecture$ = "MCA") THEN
IF DriverInstalled$ = "1" THEN
ConfigFile$ = "@601f.adf"
ELSEIF DriverInstalled$ = "2" THEN
ConfigFile$ = "@601f.adf"
ELSEIF DriverInstalled$ = "3" THEN
ConfigFile$ = "@621f.adf"
ELSEIF DriverInstalled$ = "4" THEN
ConfigFile$ = "@631f.adf"
END IF
ELSEIF (SystemArchitecture$ = "EISA") THEN
IF DriverInstalled$ = "1" THEN
ConfigFile$ = "!hwp1461.cfg"
ELSEIF DriverInstalled$ = "2" THEN
ConfigFile$ = "!hwp1461.cfg"
ELSEIF DriverInstalled$ = "3" THEN
ConfigFile$ = "!hwp2002.cfg"
ELSEIF DriverInstalled$ = "4" THEN
ConfigFile$ = "!hwp2080.cfg"
END IF
ELSE '' System Architecture is "ISA" or only 3rd party SCSI
GOTO DONE
ENDIF
GETREFDISK:
SetSymbolValue "EditTextIn", "A:\"
SetSymbolValue "EditFocus", "END"
GETREFDISKL1:
sz$ = UIStartDlg(DS2Cui$, INSERTREF, "FRefDiskDlgProc", APPHELP1, HELP1PROC$)
refDisk$ = GetSymbolValue("EditTextOut")
tStr$ = refDisk$
IF (MID$(refDisk$,LEN(refDisk$)) <> "\") THEN
refDisk$ = tStr$ + "\"
ENDIF
IF (sz$ = "CONTINUE") THEN
UIPop 1
IF (IsDirWritable(refDisk$) = 0) THEN
GOSUB BADPATH
GOTO GETREFDISKL1
ENDIF
'' saveCursor% = ShowWaitCursor()
CopyFile MakePath(DEST$,ConfigFile$), MakePath( refDisk$,ConfigFile$), cmoNone, 0
'' RestoreCursor saveCursor%
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETREFDISKL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO DONE
ELSE
UIPop 1
GOSUB ASKQUIT2
GOTO GETREFDISK
ENDIF
GOTO DONE
BADPATH:
sz$ = UIStartDlg(DS2Cui$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT2:
sz$ = UIStartDlg(DS2Cui$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT2
ELSE
UIPop 1
END IF
RETURN
DONE:
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