home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Multi-CD Magazin 1993 January
/
MultiCDMagazin0193_2ndEd.bin
/
squeue
/
zsetupsq.ms_
/
zsetupsq.ms
Wrap
Text File
|
1993-09-28
|
10KB
|
299 lines
'**************************************************************************
'* Zenographics Setup Script for SuperQueue
'* (C) 1993 Zenographics Inc.
'**************************************************************************
''$DEFINE DEBUG 'Define for script development/debugging; comment
'out or remove this definition for release versions.
'==============================================================================
' Include files
'------------------------------------------------------------------------------
'$INCLUDE 'zapi.mst'
'$INCLUDE 'zdetect.mst'
'==============================================================================
' Constant Declarations
'==============================================================================
'Dialog ID's. These numbers identify a dialog template in MSCUISTF.DLL.
CONST IDD_MSG_WELCOME_SQ = 3000
CONST IDD_MSG_FAILURE = 1200
CONST IDD_MSG_ABORTED = 1300
CONST IDD_MSG_COMPLETED = 1400
CONST IDD_ASK_AUTOQUEUE = 6000
CONST IDD_MSG_HOWTOUNQUEUE = 3100
CONST IDD_ERR_BADPATH = 8200
CONST IDD_MSG_SQNOTONPATH = 3600
CONST FALSE = 0
CONST TRUE = (NOT FALSE)
'Bitmap ID. This identifies the bitmap resource used for the logo in the
'main window.
CONST LOGO_SUPERQUEUE = 1
'==============================================================================
' Global Variable and Procedure Declarations
'==============================================================================
GLOBAL CUIDLL$ 'Holds name of our custom DLL
GLOBAL HELPPROC$ 'Holds name of the help dialog procedure
GLOBAL CWDIR$ 'Path of current working directory
GLOBAL WINPATH$ 'The Windows path
GLOBAL SYSPATH$ 'the Windows System path
GLOBAL INSTPATH$
GLOBAL HELPID$
GLOBAL StatusItems$
DECLARE SUB DoAskQuit
DECLARE SUB FCloseApplication LIB "MSCUI_sq.DLL" (AppClassName$, hInst%)
declare sub SetFrameHandle lib "mscui_sq.dll" (hwnd%)
DECLARE FUNCTION AppendBackslash (a$) AS STRING
DECLARE SUB CreatePathList( a$ )
DECLARE FUNCTION SearchList (listname$, key$) AS INTEGER
DECLARE SUB WinExec LIB "KERNEL.EXE" ( Appname$, Show% )
'==============================================================================
' Code
' ----
' Actual work starts here.
'==============================================================================
'-----------------------------
'$IFDEF VERBOSE
echo on
'$ENDIF
CUIDLL$ = "mscui_sq.dll" 'Custom user interface dll
HELPPROC$ = "" 'Help dialog procedure
INFFILENAME$ = "ZENO.INF" 'Our specific disk layout .INF filename
SrcPath$ = GetSymbolValue("STF_SRCDIR")
CWD$ = GetSymbolValue("STF_CWDDIR")
WinIniFile$ = GetWindowsDir + "WIN.INI"
WINPATH$ = GetWindowsDir
SYSPATH$ = GetWindowsSysDir
INSTPATH$ = WINPATH$
TempList$ = "MAINTEMPLIST"
HelpID$ = "HelpTopic"
StatusItems$ = "StatusItems"
SetupLog$ = "SQSETUP.LOG"
ProgManGroup$ = "SuperQueue"
SetBitmap CUIDLL$, LOGO_SUPERQUEUE
SetWindowText HwndFrame(), "SuperQueue Setup"
SetFrameHandle HwndFrame()
'Figure out where to find the disk layout .INF file. First check
'to see if the user explicitly named an .INF path and filename, otherwise
'look for one in the current working directory.
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = CWD$ + INFFILENAME$
END IF
ReadInfFile szInf$
'Close these if they're running.
FCloseApplication "SUPERQUE", HinstFrame
'Check that we're running in at least Windows 3.10.
i% = GetWindowsMajorVersion * 100 + GetWindowsMinorVersion
'' ### AK 4.93 ###
if i% < 310 then
i% = DoMsgBox("SuperQueue erfordert Windows 3.10 oder höher.", "Setup Error", MB_ICONHAND)
end
end if
'--------------------------------------------------------------------------
'This is the initial dialog box that the user sees, "Welcome".
'Show the Welcome dialog box and wait for a user decision.
CreatePathList( "PathList" )
WELCOME:
SetSymbolValue "EditTextIn", INSTPATH$
sz$ = ""
while sz$ <> "CONTINUE"
sz$ = UIStartDlg(CUIDLL$, IDD_MSG_WELCOME_SQ, "FEditDlgProc", 0, "")
if sz$ = "EXIT" then
error STFQUIT
end if
wend
UIPop 1
INSTPATH$ = GetSymbolValue( "EditTextOut" )
if FIsDirWritable( INSTPATH$ ) = 0 then
sz$ = ""
RemoveSymbol StatusItems$
AddListItem StatusItems$, INSTPATH$
while sz$ <> "CONTINUE"
sz$ = UIStartDlg( CUIDLL$, IDD_ERR_BADPATH, "FBadPathDlgProc", 0, "" )
wend
UIPOP 1
goto WELCOME
end if
if SearchList( "PathList", AppendBackslash( INSTPATH$ )) = 0 then
sz$ = ""
RemoveSymbol StatusItems$
AddListItem StatusItems$, INSTPATH$
while sz$ <> "CONTINUE" and sz$ <> "BACK"
sz$ = UIStartDlg( CUIDLL$, IDD_MSG_SQNOTONPATH, "FBadPathDlgProc", 0, "" )
wend
UIPop 1
if sz$ <> "CONTINUE" then
goto WELCOME
end if
end if
'==============================================================================
' Here's the actual file copying, WIN.INI file changes, etc.
'==============================================================================
INSTALLATION:
CreateDir INSTPATH$, cmoVital
OpenLogFile INSTPATH$ + SetupLog$, 0
print "Installation Path: ";INSTPATH$
AddSectionFilesToCopyList "System", SrcPath$, SYSPATH$
AddSectionFilesToCopyList "SuperQueue", SrcPath$, INSTPATH$
AddSectionFilesToCopyList "Miscellaneous", SrcPath$, INSTPATH$
'----------------------------
'Now install the files!
'$IFDEF DEBUG
i% = SetCopyMode (0)
'$ENDIF
CopyFilesInCopyList
ResetCopyList
'----------------------------
'Make changes to .INI files here.
CreateIniKeyValue WinIniFile$, "SuperQueue", "Processing", "2", cmoOverwrite
ProgManGroup$ = "SuperQueue"
CreateProgmanGroup ProgManGroup$, "", cmoNone
ShowProgmanGroup ProgManGroup$, 1, cmoNone
CreateProgmanItem ProgManGroup$, "Super Queue", INSTPATH$ + "SUPERQUE.EXE", "", cmoOverwrite
'' ### 4.93 AK ### -- we don't use SQ SuperHelp, so commented out
'' CreateProgmanItem ProgManGroup$, "SuperQueue SuperHelp", "WINHELP " + INSTPATH$ + "SQSUPER.HLP", "", cmoOverwrite
CreateProgmanItem ProgManGroup$, "Read Me", "WRITE " + INSTPATH$ + "SQREADME.WRI", "", cmoOverwrite
CreateProgmanItem ProgManGroup$, "De-Install", "WRITE " + INSTPATH$ + "SQDEINST.WRI", "", cmoOverwrite
' If the Windows has a default printer registered, ask 'em if they want
' it to be queued.
a$ = GetIniKeyString( WinIniFile$, "windows", "device" )
b$ = ucase$( GetNthFieldFromIniString( a$, 2 ))
a$ = GetNthFieldFromIniString( a$, 1 )
if a$ <> "" and b$ <> "QD" then
RemoveSymbol StatusItems$
AddListItem StatusItems$, a$
sz$ = ""
while sz$ <> "CONTINUE" and sz$ <> "EXIT"
sz$ = UIStartDlg( CUIDLL$, IDD_ASK_AUTOQUEUE, "FBadPathDlgProc", 0, "")
wend
UIPop 1
if sz$ = "CONTINUE" then
sz$ = ""
while sz$ <> "CONTINUE"
sz$ = UIStartDlg( CUIDLL$, IDD_MSG_HOWTOUNQUEUE, "FInfoDlgProc", 0, "" )
wend
UIPOP 1
CreateIniKeyValue WinIniFile$, "SuperQueue", a$, "*B", cmoNone
'Turn off Print Manager, turn on "Direct To Port".
CreateIniKeyValue WinIniFile$, "windows", "spooler", "no", cmoOverwrite
CreateIniKeyValue WinIniFile$, "windows", "DosPrint", "no", cmoOverwrite
end if
end if
CreateProgmanItem ProgManGroup$, "sqsetup.log", "NOTEPAD " + INSTPATH$ + SetupLog$, "", cmoOverwrite
WinExec INSTPATH$ + "SUPERQUE.EXE", 7 'Run SQ as an icon (inactive).
sz$ = ""
while sz$ <> "CONTINUE"
sz$ = UIStartDlg( CUIDLL$, IDD_MSG_COMPLETED, "FInfoDlgProc", 0, "" )
wend
UIPopAll
END
'------------------------------------------------------------------------------
FUNCTION AppendBackslash( a$ ) STATIC AS STRING
if mid$( a$, len( a$ ), 1 ) <> "\" then
a$ = a$ + "\"
end if
AppendBackslash = a$
END FUNCTION
'------------------------------------------------------------------------------
SUB CreatePathList( a$ ) STATIC
RemoveSymbol a$
AddListItem a$, GetWindowsDir
AddListItem a$, GetWindowsSysDir
path$ = string$( 512, 32 )
i% = CbGetEnvVariableValue( "PATH", path$, 512 )
if path$ <> "" then
i% = 1
path$ = rtrim$(path$)
while i% <> 0
j% = instr( i%, path$, ";" )
if j% then
b$ = mid$( path$, i%, j% - i% )
i% = j% + 1
else
b$ = mid$( path$, i% )
i% = 0
end if
if len(b$) then
AddListItem a$, AppendBackslash( b$ )
end if
wend
end if
END SUB
'------------------------------------------------------------------------------
' ### ak 9.93 ### compare both strings in uppercase
FUNCTION SearchList ( listname$, key$ ) STATIC AS INTEGER
for i% = GetListLength( listname$ ) to 1 step -1
if ucase$( key$ ) = ucase$( GetListItem( listname$, i% )) then
exit for
end if
next
SearchList = i%
END FUNCTION
'==============================================================================
' Error Handling
'==============================================================================
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = STFQUIT THEN
dlg% = IDD_MSG_ABORTED
ELSE
dlg% = IDD_MSG_FAILURE
END IF
IF ERR <> 0 THEN
PRINT "Abend: ERR="; ERR
END IF
sz$ = ""
while sz$ <> "CONTINUE"
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
wend
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call Zenographics Technical Support!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END