home *** CD-ROM | disk | FTP | other *** search
- '**************************************************************************
- '* MSSetup for Updata 'Teleshares
- '**************************************************************************
-
- '$DEFINE DEBUG ''Define for script development/debugging
-
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
-
- ''Dialog ID's
- CONST MB_OKCANCEL = 1
- CONST MB_YESNO = 4
- CONST MB_ICONQUESTION = 32
- 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 BADPATH = 6400
- CONST MODELESS = 5000
- CONST CDGETNAMEORG = 7500
- CONST MODELESS_1 = 10000
- CONST MODELESS_2 = 10001
- CONST MODELESS_3 = 10002
- CONST MODELESS_4 = 10003
-
- ''Bitmap ID
- CONST LOGO = 1
-
- GLOBAL DEST$ ''Default destination directory.
- GLOBAL OPTCUR$ ''Option selection from option dialog.
- GLOBAL NameOut$ ''Name entered
- GLOBAL OrgOut$ ''Organisation entered
- GLOBAL nIniFlag% ''1 if ini file is one system
-
- DECLARE SUB Install
- DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
- DECLARE FUNCTION CreateWindow LIB "user" (szClassName$,szWindowName$,dwStyle%,nX%,nY%,nWidth%,nHeight%,hwndParent%,hMenu%,hInst%,szPnt%) AS INTEGER
- DECLARE FUNCTION ShowWindow LIB "user" (hWnd%,nCmdShow%) AS INTEGER
- DECLARE FUNCTION SetWindowLong LIB "user" (hWnd%,nOffset%,nVal%) AS INTEGER
- DECLARE FUNCTION UserInput LIB "s_optns.dll" (hWnd%, szString3$ ) AS INTEGER
- DECLARE FUNCTION EditSystemFiles LIB "s_edsys.dll" (hWnd%) AS INTEGER
- DECLARE FUNCTION CheckIniEntry LIB "s_edsys.dll" (hWnd%, szString4$, szString5$) AS INTEGER
- DECLARE FUNCTION WerePriceFilesChosen LIB "s_edsys.dll" ( hWnd% ) AS INTEGER
- DECLARE FUNCTION UnZipFiles LIB "s_edsys.dll" ( hWnd%, szString6$ ) AS INTEGER
- DECLARE FUNCTION SetupMicrotextHardware LIB "mtunedll.dll" (hWnd%) AS INTEGER
- DECLARE FUNCTION IsStringInString LIB "mscuistf.dll" (szString1$ , szString2$) AS INTEGER
- DECLARE FUNCTION ChangeDir LIB "mscuistf.dll" (szDir$) AS INTEGER
- DECLARE FUNCTION WinExec LIB "kernel" (lpCmdLine$, nCmdShow% ) AS INTEGER
- DECLARE SUB CreateBackDrop
- DECLARE SUB SetParameters
-
-
- INIT:
- CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
- HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
-
- SetBitmap CUIDLL$, LOGO
- SetTitle "TeleShares v2.1 Setup"
-
- CreateBackDrop
-
- szInf$ = GetSymbolValue("STF_SRCINFPATH")
- IF szInf$ = "" THEN
- szInf$ = GetSymbolValue("STF_CWDDIR") + "FILES.INF"
- END IF
-
- DEST$ = "C:\UPDATA"
-
- 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
-
-
- GETPATH:
- SetSymbolValue "EditTextIn", DEST$
- SetSymbolValue "EditFocus", "END"
- GETPATHL1:
- sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
- DEST$ = GetSymbolValue("EditTextOut")
-
- IF sz$ = "CONTINUE" THEN
- IF IsDirWritable(DEST$) = 0 THEN
- GOSUB BADPATH
- GOTO GETPATHL1
- END IF
- UIPop 1
- ELSEIF sz$ = "REACTIVATE" THEN
- GOTO GETPATHL1
- ELSE
- UIPop 1
- GOSUB ASKQUIT
- GOTO GETPATH
- END IF
-
- WinDrive$ = GetWindowsDir()
- WinFile$ = WinDrive$ + "UPDATA.INI"
- nIniFlag% = DoesFileExist (WinFile$,femExists )
- if nIniFlag% = 0 Then
- sz$ = UIStartDlg(CUIDLL$,CDGETNAMEORG,"FNameOrgDlgProc",APPHELP,HELPPROC$)
- NameOut$=GetSymbolValue("NameOut")
- OrgOut$=GetSymbolValue("OrgOut")
- UIPop 1
- end if
-
- IF sz$ = "CONTINUE" THEN
-
- ReadInfFile szInf$
-
- Install
- ClearBillboardList
- ELSE
- UIPop 1
- GOSUB ASKQUIT
- GOTO GETPATH
- END IF
-
- QUIT:
-
- SetSymbolValue "Path", DEST$
- 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, call 0181-874-4747!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
- END
-
-
-
- BADPATH:
- sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- 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
-
-
-
- SUB SetParameters STATIC
-
- drive$ = MID$(DEST$, 1, 1)
- SizeofFreeDisk& = GetFreeSpaceForDrive(drive$)
- IF SizeofFreeDisk& < 3072000 THEN
- StringOne$ = "You need at least 3MB of free space on your hard disk to install the Updata for Windows Files"
- StringTwo$ = ""
- MessageString$ = StringOne$ + StringTwo$
- i% = DoMsgBox( MessageString$, "WARNING", MB_TASKMODAL+MB_ICONHAND+MB_OK)
- WriteToLogFile "Not enough space to install Price files"
- END IF
- IF SizeofFreeDisk& > 3072000 THEN
- WriteToLogFile "Enough space to install Price files"
- END IF
-
- WinMajorVer% = GetWindowsMajorVersion()
- WinMinorVer% = GetWindowsMajorVersion()
- IF WinMajorVer% = 3 THEN
- IF WinMinorVer% > 0 THEN
- WriteToLogFile "Windows Version 3.1 detected."
- END IF
- END IF
- IF WinMajorVer% = 3 THEN
- IF WinMinorVer% < 1 THEN
- i% = DoMsgBox("This Program requires Windows 3.1 or greater.", "ERROR", MB_TASKMODAL+MB_ICONHAND+MB_OK)
- WriteToLogFile "Windows 3.0 detected."
- END IF
- END IF
-
-
-
- WinDrive$ = GetWindowsDir()
- SourceDrive$ = MakePath(DEST$, "TELETEXT.FON")
- WinFile$ = WinDrive$ + "TELETEXT.FON"
- CopyFile SourceDrive$, WinFile$, cmoNone, 0
- WriteToLogFile "Teletext font file copied OK."
-
- IF DoesIniKeyExist("WIN.INI", "fonts", "Teletext") = 0 THEN
- CreateIniKeyValue "WIN.INI", "fonts", "Teletext", "TELETEXT.FON", cmoNone
- WriteToLogFile "Teletext fonts installed OK"
- END IF
-
-
-
- SourceDrive$ = MakePath(DEST$, "UPDATA.INI")
- WinFile$ = WinDrive$ + "UPDATA.INI"
-
- if nIniFlag% = 0 Then
- CopyFile SourceDrive$, WinFile$, cmoNone, 0
- WriteToLogFile "Updata.INI file copied OK."
- CreateIniKeyValue WinFile$,"LICENCE","NAME",NameOut$,cmoOverwrite
- CreateIniKeyValue WinFile$,"LICENCE","ORG",OrgOut$,cmoOverwrite
- else
- WriteToLogFile "Updata.INI file already exists."
- end if
-
- CreateIniKeyValue WinFile$,"PATHS","UPDATA",Dest$,cmoOverwrite
-
- Path$ = GetEnvVariableValue ( "PATH" )
- i% = IsStringInString ( DEST$, Path$ )
- ''IF i% = 0 THEN
- '' StringThree$ = "Your Autoexec.bat file needs to be modified, "
- '' StringFour$ = "by placing the Updata directory on the path. "
- '' StringFive$ = "Do you want setup to modify the file for you?"
- '' Message$ = StringThree$ + StringFour$ + StringFive$
- '' i% = DoMsgBox( Message$, "MESSAGE", MB_ICONQUESTION + MB_YESNO)
- '' IF i% = 6 THEN
- '' RemoveFile "C:\AUTOEXEC.UDT",cmoNone
- '' RenameFile "C:\AUTOEXEC.BAT","AUTOEXEC.UDT"
- '' PrependToPath "C:\AUTOEXEC.UDT","C:\AUTOEXEC.BAT",DEST$,cmoNone
- '' ENDIF
- '' ENDIF
-
- StringThree$ = ""
- StringFour$ = "If you have not tuned your teletext card we suggest that you tune it. "
- StringFive$ = "Do you wish to tune your card now ? "
- Message$ = StringThree$ + StringFour$ + StringFive$
- i% = DoMsgBox( Message$, "MESSAGE", MB_TASKMODAL+MB_ICONQUESTION+MB_YESNO)
- IF i%=6 THEN
- ''** value of IDYES **
- i%=SetupMicrotextHardware (hwndFrame)
-
- SourceDrive$ = "C:\~msstfqf.t\" + "TELETEXW.INF"
- WinFile$ = MakePath ( DEST$, "TELETEXW.INF" )
- CopyFile SourceDrive$, WinFile$, cmoNone, 0
- RemoveFile SourceDrive$, cmoNone
- ENDIF
-
- WinDrive$ = GetWindowsDir()
- WinFile$ = WinDrive$ + "UPDATA.INI"
- i%=DoesIniKeyExist( WinFile$, "CHARTS", "Window0" )
- IF i% = 1 THEN
- szEntry$= GetIniKeyString( WinFile$, "CHARTS", "Window0" )
- i%=CheckIniEntry(hwndFrame,szEntry$,DEST$)
- IF NOT i% = 1 THEN
- RemoveIniSection WinFile$, "CHARTS", cmoNone
- END IF
- END IF
-
- END SUB
-
-
-
-
-
- '**
- '** Purpose:
- '** Builds the copy list and performs all installation operations.
- '** Arguments:
- '** none.
- '** Returns:
- '** none.
- '*************************************************************************
- SUB Install STATIC
-
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
- CreateDir DEST$, cmoNone
- CreateDir DEST$+"\temp", cmoNone
- CreateDir DEST$+"\prices", cmoNone
- CreateDir DEST$+"\export", cmoNone
- CreateDir DEST$+"\download", cmoNone
-
- OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
- WriteToLogFile ""
- WriteToLogFile " User chose as destination directory: '" + DEST$ + "'"
- WriteToLogFile " User chose option: '" + OPTCUR$ + "'"
- WriteToLogFile ""
- WriteToLogFile "May have had to create the directory: " + DEST$
- WriteToLogFile ""
-
- AddSectionFilesToCopyList "Files", SrcDir$, DEST$
- AddToBillboardList "mscuistf.dll", MODELESS_1,"Billboard_1DlgProc", 1
- AddToBillboardList "mscuistf.dll", MODELESS_1,"Billboard_2DlgProc", 1
- AddToBillboardList "mscuistf.dll", MODELESS_1,"Billboard_3DlgProc", 1
- AddToBillboardList "mscuistf.dll", MODELESS_1,"Billboard_4DlgProc", 1
- CopyFilesInCopyList
-
-
-
-
- SetParameters
-
- CreateProgmanGroup "Updata Programs", "", cmoNone
- ShowProgmanGroup "Updata Programs", 1, cmoNone
- CreateProgmanItem "Updata Programs", "Updata TeleShares v2.1 ", MakePath(DEST$,"telshare.exe"), "", cmoOverwrite
- CreateProgmanItem "Updata Programs", "TeleShares Tutorial", MakePath(DEST$,"tel_tut.hlp"), "", cmoOverwrite
- CreateProgmanItem "Updata Programs", "Teleshares Graphing", MakePath(DEST$,"tgraph.exe"), "", cmoOverwrite
- szOther$ = DEST$ + "\info.ico, 0, 0, 0, "
- CreateProgmanItem "Updata Programs", "Updata Information", MakePath(DEST$,"udprods.wri"), szOther$, cmoOverwrite
-
-
-
-
- CloseLogFile
-
- 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
-
-
- SUB CreateBackDrop STATIC
-
- SetWin%=SetWindowLong(HwndFrame,-16,449773568)
- ShowWin%=ShowWindow(hwndFrame,3)
-
- END SUB
-