home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1998 June A
/
Pcwk6A98.iso
/
Wtestowe
/
Easycad
/
ECW.MS_
/
ECW.MS
Wrap
Text File
|
1996-05-13
|
12KB
|
382 lines
' EasyCAD Setup Script for DEMO VERSION
' Copyright (C) 1994, Evolution Computing. All rights reserved
' Written by Ken Hill 25-Sep-1994
' Mods by Scott Boster 08-Oct-1994
' Mods for DEMO version 05-11-1995
' Added UPDATE and DXFIN modules 06-01-95
' Added C_*.* and BC450RTL.DLL 05-14-96
'$DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST WELCOME = 100
CONST OPTSELDLG = 101
CONST USEDPATH = 102
CONST ASKQUIT = 103
CONST EXITFAILURE = 104
CONST EXITQUIT = 105
CONST EXITSUCCESS = 106
CONST APPHELP = 107
CONST BADPATH = 108
CONST VERERR = 109
CONST CHIPERR = 110
CONST USERINFO = 111
CONST BILLBOARD1 = 112
CONST BILLBOARD2 = 113
CONST NONAME = 114
CONST NOSERIALNUM = 115
CONST EXITRESTART = 116
''Bitmap ID
CONST LOGO = 300
GLOBAL DEST$ ''Default destination directory.
GLOBAL DRAWINGDIR$
GLOBAL SAMPLESDIR$
GLOBAL USERNAME$
GLOBAL USERORG$
GLOBAL SERIALNUM$
DECLARE SUB Install
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
INIT:
CUIDLL$ = "ecwcui.dll" ''Custom user interface dll
HELPPROC$ = "HelpDlg" ''Help dialog procedure
'setup main program windows
SetBitmap CUIDLL$, LOGO
SetTitle "EasyCAD Setup"
'default file destination directories
DEST$ = "C:\ECADWIN"
DRAWINGSUBDIR$ = ""
SAMPLESSUBDIR$ = ""
DRAWINGDIR$ = DEST$ + DRAWINGSUBDIR
SAMPLESDIR$ = DEST$ + SAMPLESSUBDIR
'User information
USERNAME="Demo Version"
USERORG=""
SERIALNUM="Evaluation Copy"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "ECW.INF"
END IF
ReadInfFile szInf$
'$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$, WELCOME, "InfoDlg", 0, "")
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO WELCOME
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
'Check windows version
MajVer% = GetWindowsMajorVersion()
MinVer% = GetWindowsMinorVersion()
IF MajVer% < 3 OR (MajVer = 3 AND MinVer% = 0) THEN
VERERR:
sz$ = UIStartDlg(CUIDLL$, VERERR, "InfoDlg", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO VERERR
END IF
UIPopAll
ERROR STFQUIT + 1
END IF
'Check processor type
IF GetProcessorType() < 3 THEN
CHIPERR:
sz$ = UIStartDlg(CUIDLL$, CHIPERR, "InfoDlg", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO CHIPERR
END IF
UIPopAll
ERROR STFQUIT + 1
END IF
SetSymbolValue "DestDir", DEST$
SetSymbolValue "SamplesDir", SAMPLESDIR$
SetSymbolValue "DrawingDir", DRAWINGDIR$
SetSymbolValue "SamplesSubDir", SAMPLESSUBDIR$
SetSymbolValue "DrawingSubDir", DRAWINGSUBDIR$
OPTSEL:
sz$ = UIStartDlg(CUIDLL$, OPTSELDLG, "OptSelDlg", APPHELP, HELPPROC$)
IF sz$ = "CONTINUE" THEN
DEST$ = GetSymbolValue("DestDir")
SAMPLESDIR$ = GetSymbolValue("SamplesDir")
DRAWINGDIR$ = GetSymbolValue("DrawingDir")
IF IsDirWritable(DEST$) = 0 OR IsDirWritable(SAMPLESDIR$) = 0 OR IsDirWritable(DRAWINGDIR$) = 0 THEN
GOSUB BADPATH
GOTO OPTSEL
END IF
IF DoesDirExist(DEST$) = 1 THEN
USEDPATH:
sz2$ = UIStartDlg(CUIDLL$, USEDPATH, "InfoDlg", 0, "")
IF sz2$ = "REACTIVATE" THEN
GOTO USEDPATH
END IF
UIPop 1
IF sz2$ = "BACK" THEN
GOTO OPTSEL
END IF
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO OPTSEL
ELSE
GOSUB ASKQUIT
GOTO OPTSEL
END IF
' 'Get user information
' SetSymbolValue "UserName",USERNAME$
' SetSymbolValue "UserOrg",USERORG$
' SetSymbolValue "SerialNum",SERIALNUM$
'USERINFO:
' sz$ = UIStartDlg(CUIDLL$, USERINFO, "UserInfoDlg", APPHELP, HELPPROC$)
' IF sz$ = "CONTINUE" THEN
' USERNAME$ = GetSymbolValue("UserName")
' USERORG$ = GetSymbolValue("UserOrg")
' SERIALNUM$ = GetSymbolValue("SerialNum")
' IF USERNAME$ = "" THEN
'NONAME:
' sz2$ = UIStartDlg(CUIDLL$, NONAME, "InfoDlg", 0, "")
' IF sz2$ = "REACTIVATE" THEN
' GOTO NONAME
' ELSEIF sz2$ = "EXIT" THEN
' GOSUB ASKQUIT
' GOTO NONAME
' END IF
' UIPop 1
' GOTO USERINFO
' END IF
' IF SERIALNUM$ = "" THEN
'NOSERIALNUM:
' sz2$ = UIStartDlg(CUIDLL$, NOSERIALNUM, "InfoDlg", 0, "")
' IF sz2$ = "REACTIVATE" THEN
' GOTO NOSERIALNUM
' ELSEIF sz2$ = "EXIT" THEN
' GOSUB ASKQUIT
' GOTO NOSERIALNUM
' END IF
'
' UIPop 1
' GOTO USERINFO
' END IF
' ELSEIF sz$ = "REACTIVATE" THEN
' GOTO USERINFO
' ELSEIF sz$ = "EXIT" THEN
' GOSUB ASKQUIT
' GOTO USERINFO
' END IF
' UIPop 1
' IF sz$ = "BACK" THEN
' GOTO OPTSEL
' ENDIF
'
' 'Setup billboard
' AddToBillboardList CUIDLL$, BILLBOARD1, "BillboardDlg", 100
Install
' 'Clean everything up
' ClearBillboardList
ClearCopyList
RemoveSymbol "DestDir"
RemoveSymbol "SamplesDir"
RemoveSymbol "DrawingDir"
RemoveSymbol "SamplesSubDir"
RemoveSymbol "DrawingSubDir"
RemoveSymbol "UserName"
RemoveSymbol "UserOrg"
RemoveSymbol "SerialNum"
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
IF RestartListEmpty() = 1 THEN
dlg% = EXITSUCCESS
ELSE
dlg% = EXITRESTART
ENDIF
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "InfoDlg", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
IF sz$ = "EXIT" THEN
dlg% = EXITQUIT
GOTO QUITL1
END IF
IF dlg% = EXITRESTART THEN
i% = ExitExecRestart()
END IF
END
ERRQUIT:
i% = DoMsgBox("Setup resources were corrupted, call (602) 967-8633!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "InfoDlg", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "InfoDlg", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
' Build the copy list and install
SUB Install STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
CreateDir DEST$, cmoNone
' Get name of .INI file that exists in the Windows directory and DELETE IT.
RmvF$=MakePath(GetWindowsDIr(), "ECAD.INI")
RemoveFile RmvF$, cmoNone
' Make new .INI file name
ini$ = MakePath(GetWindowsDir(), "ECAD.INI")
' Copy program files if requested
IF GetSymbolValue("CPY_PROGRAMFILES") = "Yes" THEN
AddSectionFilesToCopyList "ProgramFiles", SrcDir$, DEST$
IF Has87MathChip() = 1 THEN
AddSectionKeyFileToCopyList "Files", "ECW87", SrcDir$, DEST$
AddSectionKeyFileToCopyList "Files", "ECW1", SrcDir$, DEST$
AddSectionKeyFileToCopyList "Files","DXFIN",SrcDir$,DEST$
AddSectionKeyFileToCopyList "Files","UPD",SrcDir$,DEST$
ELSE
AddSectionKeyFileToCopyList "Files","ECWSFP",SrcDir$,DEST$
AddSectionKeyFileToCopyList "Files","ECW1SFP",SrcDir$,DEST$
AddSectionKeyFileToCopyList "Files","DXFINSFP",SrcDir$,DEST$
AddSectionKeyFileToCopyList "Files","UPDSFP",SrcDir$,DEST$
END IF
' Install CTL3DV2
AddSectionKeyFileToCopyList "Files","CTL3DV2",SrcDir$,MakePath(GetWindowsDir(),"SYSTEM")
' Install BC450RTL.DLL
AddSectionKeyFileToCopyList "Files","BC450RTL",SrcDir$,MakePath(GetWindowsDir(),"SYSTEM")
' Install XPs (HW or SFP) into INI file
RemoveIniSection ini$, "Modules", cmoNone
ecw1xp$ = MakePath(DEST$, "ecw1.xp")
CreateIniKeyValue ini$, "Modules", ecw1xp$, "" , cmoNone
ecw1xp$ = MakePath(DEST$, "update.xp")
CreateIniKeyValue ini$, "Modules", ecw1xp$, "" , cmoNone
ecw1xp$ = MakePath(DEST$, "dxfin.xp")
CreateIniKeyValue ini$, "Modules", ecw1xp$, "" , cmoNone
ecw1xp$ = MakePath(DEST$, "c_utils.xp")
CreateIniKeyValue ini$, "Modules", ecw1xp$, "" , cmoNone
END IF
' Copy sample drawings if requested
IF GetSymbolValue("CPY_SAMPLEDRAWINGS") = "Yes" THEN
CreateDir DRAWINGDIR$, cmoNone
AddSectionFilesToCopyList "SampleDrawings", SrcDir$, DRAWINGDIR$
END IF
''' ' Copy other samples (scripts, macros, etc.) if requested
''' IF GetSymbolValue("CPY_SAMPLES") = "Yes" THEN
''' CreateDir SAMPLESDIR$, cmoNone
''' AddSectionFilesToCopyList "Samples", SrcDir$, SAMPLESDIR$
'''
''' ' Install xpdemo.xp in INI file
''' xpdemoxp$ = MakePath(DEST$, "ecw1.xp")
''' CreateIniKeyValue ini$, "Modules", xpdemoxp$, "" , cmoNone
''' END IF
' Add user info to ini file
CreateIniKeyValue ini$, "User", "Name", USERNAME$, cmoNone
CreateIniKeyValue ini$, "User", "Organization", USERORG$, cmoNone
CreateIniKeyValue ini$, "User", "SerialNo", SERIALNUM$, cmoNone
' Do the copying
SetCopyGaugePosition 30, 100
CopyFilesInCopyList
' Create program group if requested
IF GetSymbolValue("MK_PRGGRP") = "Yes" THEN
CreateProgmanGroup "EasyCAD", "", cmoNone
ShowProgmanGroup "EasyCAD", 1, cmoNone
ecwpath$ = MakePath(DEST$, "ecw.exe")
hlppath$ = MakePath(DEST$, "ecad.hlp")
CreateProgmanItem "EasyCAD", "EasyCAD", ecwpath$, "", cmoOverwrite
CreateProgmanItem "EasyCAD", "EasyCAD Help", hlppath$, "", cmoOverwrite
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