home *** CD-ROM | disk | FTP | other *** search
- '**************************************************************************
- '* MSSetup Script for installing DDWin
- '*
- '* PROJECT: DragonDictate for Windows
- '* CREATED: 1 Apr 1994
- '* AUTHOR: Steve Squires
- '*
- '* (C) Copyright Dragon Systems, Inc. 1993-1994.
- '* All Rights Reserved
- '*
- '* ** DRAGON SYSTEMS CONFIDENTIAL **
- '*
- '*
- '* History
- '' *tlib-revision-history*
- '' *tlib-revision-history*
- '' changed embedded "readme.wri" to READ_ME from 'localize.inc'
- ''
- '' Changed initial sound board setting from 'BestTry' to 'MMLevel'
- ''
- '' fixed MakePath to handle "" argument properly and return just the
- '' install destination path
- ''
- '' now showing normal mouse cursor during main copying, since there
- '' is a dialog with a Cancel button on it during this time
- ''
- '' now adding 5MB to estimate of disk space needed. This compensates for
- '' inaccurate estimates from DoubleSpace, Stacker, etc. 5MB was picked since
- '' it is roughly what is needed to create initial user, which will almost
- '' always be done right after install anyway.
- ''
- '' now manually copying README.WRI from Setup Disk1 to target install path
- '' so Setup program does not complain when QA updates it and changes
- '' file size at last minute
- ''
- '' FILEPATH_INSTALL moved to localize.inc for localization
- '' now prototyping ReportBufferOverflow from localize.inc BEFORE include
- '' of setupapi.inc for clean internationalization with a single .inc file
- ''
- '' now deleting any pre-existing base .USR files in install directory
- ''
- '' fixed problem checking for existing version
- ''
- '' tracking phrases voc now called Tracking
- '' Dictation base voc now gone
- '' added Tracking/prnbuild to systems word vocs
- ''
- '' INI file now called Dragon.INI
- ''
- '' now displaying disk space requirements in K, checking for ACPA driver
- '' DragDev parameters now in DGNSRVR.INI
- ''
- '' fixed problems handling 'this disk doesn't have enough space try another'
- ''
- '' now passes path of Setup disks to SetAppSpecificIniStuff
- ''
- '' switched install model to merely ask for all base files or none.
- '' initial User always created by DDWin itself
- ''
- '* reconfigured for international setups
- ''
- '* sds 11 Mar 1994 updated for different INI file layout
- '* now loads backup dictation vocs
- '* sds 24 Feb 1994 enabled update of VoiceBar.exe with owner/org
- '* sds 23 Feb 1994 now adds a ton of App-Specific stuff to INI file
- '* sds 26 Jan 1994 changed title to DragonDictate for Windows
- '* sds 12 Jan 1994 fixed bug setting wrong bringup group in .INI
- '* sds 13 Dec 1993 Progman group now "DragonDictate for Windows"
- '* sds 6 Dec 1993 removed space from DragonDictate
- '* sds 30 Nov 1993 adapted from Talk->To version
- '*
- '**************************************************************************
-
- '* '$DEFINE DEBUG ''Define for script development/debugging
-
- '' actually defined in localize.inc, but setupapi.inc calls it
- DECLARE FUNCTION ReportBufferOverflow( ) AS INTEGER
-
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
-
- DECLARE FUNCTION DlgGetUserOrg LIB "mscuistf.dll" AS INTEGER
- DECLARE FUNCTION DlgSetUserOrg LIB "mscuistf.dll" AS INTEGER
- DECLARE FUNCTION CheckMMDriver LIB "mscuistf.dll" AS INTEGER
-
- ''Dialog ID's
- CONST DLG_WELCOME = 100
- CONST DLG_ASKQUIT = 200
- CONST DLG_DESTPATH = 300
- CONST DLG_EXITFAILURE = 400
- CONST DLG_EXITQUIT = 600
- CONST DLG_EXITSUCCESS = 700
-
- CONST DLG_APPHELP = 900
-
- CONST DLG_BADPATH = 6400
- CONST DLG_USERNAME = 7900
- CONST DLG_NOWAY = 8000
- CONST DLG_REPLACE = 8100
- CONST DLG_WRITEPROTECT = 8200
- CONST DLG_NOSPACE = 8300
- CONST DLG_BASENAME = 8400
-
-
- ''Bitmap ID
- CONST LOGO = 1
-
- ''
- ''File Names and other version-dependent strings
- ''
- CONST FILE_INI = "dragon.INI"
- CONST FILE_INF = "ddwin.INF"
- CONST FILE_TOOLBAR = "voicebar.exe"
-
- DECLARE FUNCTION MakePath (szFile$) AS STRING
-
- '' this include file depends on FILE_TOOLBAR defined above
- '$INCLUDE 'localize.inc'
-
- GLOBAL DEST$ ''Default destination directory.
- GLOBAL OPTCUR$ ''Option selection from option dialog.
- GLOBAL UserName$ '' user name for registration
- GLOBAL UserCmdFileName$ '' name of Command-mode main vocabulary
- GLOBAL UserDictFileName$ '' name of Dictation vocabulary
- GLOBAL SrcPath$ '' where Setup is coming from
- GLOBAL OrgName$
- GLOBAL Title$
- GLOBAL SetupTitle$ '' used for msg boxes
- GLOBAL ProgmanTitle$ '' used for Program Manager group
- GLOBAL CUIDLL$
- GLOBAL ReInstall%
- GLOBAL AllBases%
- GLOBAL bFixingPath%
-
- DECLARE SUB Install
-
- INIT:
- CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
- HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
-
- DEST$ = FILEPATH_INSTALL ''Default target directory
-
- SetBitmap CUIDLL$, LOGO
- Title$ = STR_TITLE
-
- SetupTitle$ = Title$ + STR_SETUP
- ProgmanTitle$ = Title$
-
- SetTitle Title$
-
- '' assume this is not a re-install
- ReInstall% = 0
-
- SetSymbolValue "UserName", ""
- SetSymbolValue "UserOrg", ""
-
- '' DlgGetUserOrg isn't a dialog box routine at all, it's just named
- '' that way to deter hackers. It really extracts the user name and
- '' organization from the magic file on first setup disk
- i% = DlgGetUserOrg()
- T$ = GetSymbolValue("BADUSERORGFILE")
- if T$ = "Y" THEN
- '' somebody mucked with user/organization file
- GOTO ERRQUIT
- END IF
- UserName$ = GetSymbolValue("UserName")
- cch% = len(UserName$)
- if cch% > 0 then
- '' re-install from same diskettes
- ReInstall% = 1
- end if
-
- szInf$ = GetSymbolValue("STF_SRCINFPATH")
- IF szInf$ = "" THEN
- szInf$ = GetSymbolValue("STF_CWDDIR") + FILE_INF
- END IF
- ReadInfFile szInf$
-
- OPTCUR$ = "1"
-
- '$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(CUIDLL$, DLG_WELCOME, "FWelcomeDlgProc", DLG_APPHELP, HELPPROC$)
- IF sz$ = "CONTINUE" THEN
- UIPop 1
- ELSE
- GOSUB ASKQUIT
- GOTO WELCOME
- END IF
-
- bFixingPath% = 0
-
- GETPATH:
- SetSymbolValue "EditTextIn", DEST$
- SetSymbolValue "EditFocus", "END"
- GETPATHL1:
- sz$ = UIStartDlg(CUIDLL$, DLG_DESTPATH, "FEditDlgProc", DLG_APPHELP, HELPPROC$)
- IF sz$ = "CONTINUE" THEN
- DEST$ = GetSymbolValue("EditTextOut")
- 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
- if bFixingPath% = 1 then
- '' We got here after asking everything and then finding out ther3
- '' was not enuf disk space. User wanted to change install
- '' directory, then pressed 'Back'. Most useful thing to do
- '' is back up to GetBases (which was the last regular dialog)
- '' where they can un-select install of
- '' more base files than disk can handle.
- bFixingPath% = 0
- goto GetBases
- end if
- GOTO WELCOME
- ELSE
- GOSUB ASKQUIT
- GOTO GETPATH
- END IF
-
- '' check directory
- CheckDir:
- SrcPath$ = GetSymbolValue("SRCPATH")
-
- i% = DoesDirExist(DEST$)
- IF i% > 0 THEN
- '' directory exists
- i% = DoesFileExist(MakePath(FILE_TOOLBAR), femExists)
- IF i% > 0 THEN
- '' there is an existing version installed
- Date_Already$ = GetDateOfFile(MAKEPATH(FILE_TOOLBAR))
- '' just want yyyy-mm-dd
- Date_Already$ = MID$( Date_Already$, 1, 10)
- IF Date_Already$ > "1990" THEN
- '' have a file to compare to
- Date_This$ = GetSectionKeyDate("Files", "voicebar")
- if Date_This$ < "1990" then
- '' did not find key in .INF file
- ERROR STFERR
- end if
- IF Date_This$ = Date_Already$ OR Date_This$ > Date_Already$ THEN
- '' installing same or newer version - warn'em
- sz$ = UIStartDlg(CUIDLL$, DLG_REPLACE, "FReplaceDlgProc", 0, "")
- UIPop 1
- IF sz$ = "CONTINUE" THEN
- if bFixingPath% = 1 then
- '' have already asked other questions - just fixing
- '' path on no-disk-space problem
- goto CheckSpace
- end if
- GOTO GetUser
- ELSE
- GOTO GetPath
- END IF
- ELSE
- '' installing OLDER version over newer - no way
- SetSymbolValue "EditTextIn", DEST$
- SetSymbolValue "EditFocus", "END"
- CheckDir1:
- sz$ = UIStartDlg(CUIDLL$, DLG_NOWAY, "FEditDlgProc", DLG_APPHELP, HELPPROC$)
- IF sz$ = "CONTINUE" THEN
- DEST$ = GetSymbolValue("EditTextOut")
- IF IsDirWritable(DEST$) = 0 THEN
- GOSUB BADPATH
- GOTO CheckDir1
- END IF
- UIPop 1
- GOTO CheckDir
- ELSEIF sz$ = "REACTIVATE" THEN
- GOTO CheckDir1
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- GOTO GETPATH
- ELSE
- GOSUB ASKQUIT
- GOTO CheckDir
- END IF
- END IF
- END IF
- END IF
- END IF
-
- if bFixingPath% = 1 then
- '' have already asked other questions - just fixing
- '' path on no-disk-space problem
- goto CheckSpace
- end if
-
- GETUSER:
- if ReInstall% > 0 then
- goto SkipGetUser
- end if
-
- SetSymbolValue "EditTextIn", UserName$
- S$ = GetSymbolValue("UserOrg")
- SetSymbolValue "EditTextIn2", S$
- SetSymbolValue "EditFocus", "END"
- GETUSER1:
- sz$ = UIStartDlg(CUIDLL$, DLG_USERNAME, "FEditDlgProc", DLG_APPHELP, HELPPROC$)
-
- IF sz$ = "CONTINUE" THEN
- '' dlgbox guarantees will not be empty
- UserName$ = GetSymbolValue("EditTextOut")
- UIPop 1
- ELSEIF sz$ = "REACTIVATE" THEN
- GOTO GETUSER1
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- GOTO GETPATH
- ELSEIF sz$ = "WriteProtect" THEN
- sz$ = UIStartDlg(CUIDLL$, DLG_WRITEPROTECT, "FQuitDlgProc", DLG_APPHELP, HELPPROC$)
- UIPopAll
- ERROR STFQUIT
- ELSE
- GOSUB ASKQUIT
- GOTO GETUSER
- END IF
-
- SkipGetUser:
-
- '' ask if user wants base files pre-installed
- GETBASES:
- SetSymbolValue "AllBases", "0"
- GETBASE1:
- sz$ = UIStartDlg(CUIDLL$, DLG_BASENAME, "BaseDlgProc", DLG_APPHELP, HELPPROC$)
-
- IF sz$ = "CONTINUE" THEN
- sz$ = GetSymbolValue("AllBases")
- if sz$ = "0" then
- AllBases% = 0
- else
- AllBases% = 1
- end if
- UIPop 1
- ELSEIF sz$ = "REACTIVATE" THEN
- GOTO GETBASE1
- ELSEIF sz$ = "BACK" THEN
- UIPop 1
- if ReInstall% > 0 then
- '' is re-install - we never asked for user
- goto GETPATH
- else
- GOTO GETUSER
- end if
- ELSE
- GOSUB ASKQUIT
- GOTO GETBASES
- END IF
-
- CheckSpace:
- hPrev% = ShowWaitCursor()
-
- '' put together copy list so we can figure out space requirements
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
-
- ClearCopyList
- AddSectionFilesToCopyList "Files", SrcDir$, DEST$
-
- if AllBases% = 1 then
- AddBaseFiles GetWindowsDir() + FILE_INI, SrcDir$, DEST$
- end if
-
- '' which drive are we installing on ?
- diskNumber% = Asc(DEST$) - Asc( "A" )
-
- '' ask for 5MB extra for that drive. This both provides a decent chance
- '' of being able to create a new user, and also compensates for
- '' DoubleSpace and its kin which lie about how much disk space there is.
- SetSymbolValue "Extra", ""
- for i% = 1 to diskNumber%
- AddListItem "Extra", ""
- next i%
- AddListItem "Extra", "5242880"
-
- '' now see if there is enough space
- lNeeded& = GetCopyListCost( "Extra", szCost$, szNeeded$ )
-
- RestoreCursor hPrev%
-
- if lNeeded& > 0 then
- '' insufficient disk space - warn user
- lNeeded& = (lNeeded& / 1024) + 1
- SetSymbolValue "SpaceNeeded", STR$(lNeeded&)
- sz$ = UIStartDlg(CUIDLL$, DLG_NOSPACE, "FNoSpaceDlgProc", DLG_APPHELP, HELPPROC$)
- if sz$ = "CONTINUE" then
- UIPop 1
- '' see if they really freed enough space
- goto CheckSpace
- elseif sz$ = "BACK" then
- UIPop 1
- '' try another drive
- bFixingPath% = 1
- goto GETPATH
- else
- UIPopAll
- ERROR STFQUIT
- end if
- end if
-
- Install
-
- i% = CheckMMDriver()
-
- QUIT:
- ON ERROR GOTO ERRQUIT
-
- IF ERR = 0 THEN
- dlg% = DLG_EXITSUCCESS
-
- SetSymbolValue "InstallPath", DEST$
- SetSymbolValue "ReadMeCmd", "Write " + MAKEPATH( READ_ME )
-
- ELSEIF ERR = STFQUIT THEN
- dlg% = DLG_EXITQUIT
- ELSE
- dlg% = 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(STR_CORRUPTED, STR_TITLE, MB_OK+MB_TASKMODAL+MB_ICONHAND)
- END
-
- BADPATH:
- sz$ = UIStartDlg(CUIDLL$, DLG_BADPATH, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO BADPATH
- END IF
- UIPop 1
- RETURN
-
- ASKQUIT:
- sz$ = UIStartDlg(CUIDLL$, DLG_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 performs all installation operations.
- '** Arguments:
- '** none.
- '** Returns:
- '** none.
- '*************************************************************************
- SUB Install STATIC
-
- CreateDir DEST$, cmoNone
-
- OpenLogFile MakePath("LOGFILE.OUT"), 0
- WriteToLogFile ""
- WriteToLogFile " Destination directory: '" + DEST$ + "'"
- WriteToLogFile ""
-
- ini$ = GetWindowsDir() + FILE_INI
-
- hPrev% = ShowWaitCursor()
-
- '' SetAppSpecificIni stuff sets up source .USR files section in .INI
- '' file. Will need InstallPath available to clobber any old .USR's
- '' from previous versions.
- SetSymbolValue "InstallPath", DEST$
-
- '' make app-specific parameters section with special cases we know about
- sec$ = "App-Specific Parameters"
- rc% = SetAppSpecificIniStuff ( ini$, sec$, SrcPath$ )
- if rc% < 0 then
- ERROR STFERR
- end if
-
- '' copy README.WRI manually. It is not compressed and is often updated
- '' AFTER the DDWIN.INF is built, so the file size is incorrect.
- CopyFile SrcPath$+READ_ME, MakePath( READ_ME ), cmoOverwrite, 0
-
- '' do the real install - MUST happen AFTER SetAppSpecificIniStuff
- '' We restore normal cursor, since we have a dialog up that user can
- '' press 'Cancel' on.
- RestoreCursor hPrev%
- CopyFilesInCopyList
- hPrev% = ShowWaitCursor()
-
- WriteToLogFile "Finished CopyList"
-
- '' this will alter VoiceBar.exe with user name and organization
- SetSymbolValue "KeyFileName", MakePath(FILE_TOOLBAR)
- i% = DlgSetUserOrg()
-
- sec$ = "Defaults"
- CreateIniKeyValue ini$, sec$, "Main Directory", DEST$, cmoOverwrite
-
- sec$ = "System's Word Vocabularies"
- CreateIniKeyValue ini$, sec$, "Dictation1", MakePath("prndict1.voc"), cmoOverwrite
- CreateIniKeyValue ini$, sec$, "Dictation2", MakePath("prndict2.voc"), cmoOverwrite
- CreateIniKeyValue ini$, sec$, "Tracking", MakePath("prnbuild.voc"), cmoOverwrite
-
- sec$ = "System's Shared Vocabularies"
- CreateIniKeyValue ini$, sec$, "Tracking", MakePath("Tracking.voc"), cmoOverwrite
-
- '' add DragDev parameters
- sec$ = "DSP"
- CreateIniKeyValue ini$, sec$, "Path", DEST$, cmoOverwrite
- '' board address is NOT overwritten
- CreateIniKeyValue ini$, sec$, "IOADDRESS", "0x310", cmoNone
- CreateIniKeyValue ini$, sec$, "INTERRUPT", "3", cmoNone
- '' DSP vs Multimedia access is NOT overwritten
- '' For future reference, possible values are
- '' MMLevel - use multimedia only
- '' DSPLevel - use DSP only
- '' Ignore - multimedia, except if ACPA which uses DSP
- '' BestTry - DragDev figures it out - this was an internal hack
- '' that is NOT recommended, since DragDev does I/O to ACPA ports
- '' to test for its presence
- CreateIniKeyValue ini$, sec$, "Interface", "MMLevel", cmoNone
-
- UIPop 1
-
- CreateProgmanGroup ProgmanTitle$, "", cmoNone
- ShowProgmanGroup ProgmanTitle$, 1, cmoNone
- SetProgmanGroupStuff ProgmanTitle$
-
- CloseLogFile
- '* remove log when successful
- RemoveFile MakePath("LOGFILE.OUT"), cmoNone
- RestoreCursor hPrev%
-
- END SUB
-
- '**
- '** Purpose:
- '** Appends a file name to the end of a directory path,
- '** inserting a backslash character as needed.
- '** Arguments:
- '** szFile$ - filename to append to directory
- '** Returns:
- '** Resulting fully qualified path name.
- '*************************************************************************
- FUNCTION MakePath (szFile$) STATIC AS STRING
- IF DEST$ = "" THEN
- MakePath = szFile$
- ELSEIF szFile$ = "" THEN
- MakePath = DEST$
- ELSEIF MID$(DEST$, LEN(DEST$), 1) = "\" THEN
- MakePath = DEST$ + szFile$
- ELSE
- MakePath = DEST$ + "\" + szFile$
- END IF
- END FUNCTION
-