//
// Setup Installation File
// Created by Setup Builder Version 5.01.006/32
//
// Copyright © 1993 - 1997 GPP Software
//
// Created: 02-08-1997 at 17:04:51
//

// Setup procedure for installing/de-installing:

// SETUP / SETUP BUILDER


// Application Variables
SET %Caption%="Setup"
SET %Application%="Setup Builder"
SET %Company%="GPPSoftware"
SET %InstallPath%="C:\SETUP"
SET %InstallDrive%=Left("%InstallPath%", 2)
SET %Option%=1
SET %Option1%=TRUE
SET %IniFile%="BLDR16.INI"
SetSharedRegistry("%Company%", "%Application%", "%IniFile%")
IF "#INSTVER#"=="INST16" GetProfileString("Install", "Path", "%InstallPath%", "%IniFile%", %InstallPath%)
IF "#INSTVER#"=="INST32" RegGetSetting(2, "SOFTWARE\%Company%\%Application%\Install", "Path", "%InstallPath%", %InstallPath%)
AddChar(%InstallPath%, "\")
SET %InstallDrive%=Left("%InstallPath%", 2)


// Language
SetLanguage("UkEnglish")


// Copy all the bitmaps
CopyFile("GPSOFT3.BM_","%WindowsDirectory%TEMP\GPSOFT3.BMP")
CopyFile("DIAMOND.BM_","%WindowsDirectory%TEMP\DIAMOND.BMP")


// Create all the objects
CreateBackdrop("DEFAULTBACKDROP")
CreateControl("Text","%Application% Setup",-1,20,10,0,0,1048576,"Times New Roman",50,3,16777215,0)
CreateControl("Text","Install/De-Install created using Setup Builder Version 5.01.006/32|Copyright © 1993 - 1997 GPP Software|",-1,20,0,0,0,1114112,"Times New Roman",17,3,16777215,0)
EndObject()


CreateCueCard("WELCOMECARD",20,50,310,200,2)
CreateControl("Text","%Application%",-1,20,20,150,45,0,"Times New Roman",50,0,10485760,0)
CreateControl("ColourBlock","",-1,20,70,270,5,0,128)
CreateControl("Text","Welcome to %Application%, the foremost|Software Setup building tool from:",-1,25,95,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\GPSOFT3.BMP",-1,25,148,150,45,0)
EndObject()


CreateCueCard("PROMO1",20,50,400,210,2)
CreateControl("Text","Ease Of Use Designed In!",-1,20,20,150,45,0,"Times New Roman",30,0,10485760,0)
CreateControl("ColourBlock","",-1,20,50,270,5,0,128)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,90,150,45,0)
CreateControl("Text","No programming is required for simple installs",-1,50,90,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,120,150,45,0)
CreateControl("Text","You don't need to be a programmer to use %Application%",-1,50,120,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,150,150,45,0)
CreateControl("Text","Create simple installs in less than 10 minutes!",-1,50,150,150,45,0,"Times New Roman",17,0,0,0)
EndObject()


CreateCueCard("PROMO2",20,50,360,230,2)
CreateControl("Text","New Features",-1,20,20,150,45,0,"Times New Roman",30,0,10485760,0)
CreateControl("ColourBlock","",-1,20,50,150,5,0,128)
CreateControl("Text","%Application% now supports:",-1,25,70,150,45,0,"Times New Roman",20,0,16711680,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,100,150,45,0)
CreateControl("Text","User defined Backdrops",-1,50,100,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,120,150,45,0)
CreateControl("Text","User defined Dialogs",-1,50,120,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,140,150,45,0)
CreateControl("Text","User defined Cue Cards/Bill Boards",-1,50,140,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Text","All are completely configureable by the user using the",-1,25,170,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Text","%Application% in-built Project Object Designer",-1,25,190,150,45,0,"Times New Roman",17,0,0,0)
EndObject()


CreateCueCard("PROMO3",20,50,360,235,2)
CreateControl("Text","16 and 32 Bit Support",-1,20,20,150,45,0,"Times New Roman",30,0,10485760,0)
CreateControl("ColourBlock","",-1,20,50,235,5,0,128)
CreateControl("Text","%Application% now supports:",-1,25,70,150,45,0,"Times New Roman",20,0,16711680,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,100,150,45,0)
CreateControl("Text","Dual 16/32 bit platform installations",-1,50,100,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,125,150,45,0)
CreateControl("Text","Windows 95/NT Registry",-1,50,125,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,150,150,45,0)
CreateControl("Text","Windows 95/NT Shared File Registry",-1,50,150,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,175,150,12,0)
CreateControl("Text","Windows 95/NT Long File Names",-1,50,175,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,200,150,12,0)
CreateControl("Text","OLE Control Registration",-1,50,200,150,12,0,"MS Sans Serif",17,0,0,0)
EndObject()


CreateCueCard("PROMO4",20,50,400,230,2)
CreateControl("Text","New Features",-1,20,20,150,45,0,"Times New Roman",30,0,10485760,0)
CreateControl("ColourBlock","",-1,20,50,150,5,0,128)
CreateControl("Text","Try %Application%'s Optional Installations facilty!",-1,25,70,150,45,0,"Times New Roman",20,0,16711680,0)
CreateControl("Text","Optional Installations allow you to create installs for your",-1,25,100,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Text","customers which give them the choice of which components",-1,25,120,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Text","of your software to install or re-install.",-1,25,140,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Text","You can create up to 15 different options with any",-1,25,170,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Text","name you wish to give them!",-1,25,190,150,45,0,"Times New Roman",17,0,0,0)
EndObject()


CreateCueCard("PROMO5",20,50,330,220,2)
CreateControl("Text","New Features",-1,20,20,150,45,0,"Times New Roman",30,0,10485760,0)
CreateControl("ColourBlock","",-1,20,50,150,5,0,128)
CreateControl("Text","Plus lots lots more!",-1,25,70,150,45,0,"Times New Roman",20,0,16711680,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,100,150,45,0)
CreateControl("Text","Complete new MDI user interface",-1,50,100,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,120,150,45,0)
CreateControl("Text","Many new script language enhancements",-1,50,120,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,140,150,45,0)
CreateControl("Text","Better multitasking",-1,50,140,150,45,0,"Times New Roman",17,0,0,0)
CreateControl("Bitmap","%WindowsDirectory%TEMP\DIAMOND.BMP",-1,25,160,150,12,0)
CreateControl("Text","New Integrated Debugger",-1,50,160,150,12,0,"Times New Roman",17,0,0,0)
CreateControl("Text","In fact, many of the things you have asked for!",-1,25,190,150,45,0,"Times New Roman",17,0,0,0)
EndObject()


// Close Setup Program
HideSetup()


// Display appropriate backdrop
GetScreenWidth(%Width%)
SET %BackDrop%="DEFAULTBACKDROP"
IF "%BackDrop%" != "(None)" ShowBackdrop("%BackDrop%")


// Determine if s/w is already installed
SET %DoUpgrade% = FALSE
IF "#INSTVER#"=="INST16" GetProfileString("Install", "DeInstallScript", "%InstallPath%DEINST.INF", "%IniFile%", %DeInstall%)
IF "#INSTVER#"=="INST32" RegGetSetting(2, "SOFTWARE\%Company%\%Application%\Install", "DeInstallScript", "%InstallPath%DEINST.INF", %DeInstall%)
IF "#INSTVER#"=="INST16" GetProfileString("Install", "Installed", "0", "%IniFile%", %Installed%)
IF "#INSTVER#"=="INST32" RegGetInt(2, "SOFTWARE\%Company%\%Application%\Install", "Installed", 0, %Installed%)
IF %Installed% != 0 GOTO :GOTVERSION
SET %DoUpgrade% = TRUE
SET %DeInstall% = "%InstallPath%DEINST.INF"
CheckExists("%DeInstall%")
SET %Installed% = %ERROR%
IF %ERROR% == TRUE GOTO :GOTVERSION
SET %DeInstall% = "%InstallPath%DEINST.SCR"
CheckExists("%DeInstall%")
SET %Installed% = %ERROR%
IF %ERROR% == TRUE GOTO :GOTVERSION
SET %DeInstall% = "%InstallPath%Setup.SCR"
CheckExists("%DeInstall%")
SET %Installed% = %ERROR%
:GOTVERSION


// User defined code - initialisation
// Find out what is or is not installed so we
// can prompt the user with what still needs installing
CheckExists("%InstallPath%*.EXE")
SET %Option1% = NOT %ERROR%

CheckExists("%InstallPath%SAMPLES\*.*")
SET %Option2% = NOT %ERROR%

CheckExists("%InstallPath%OBJECTS\*.*")
SET %Option3% = NOT %ERROR%



// Welcome Dialog
:BACK1
SET %Message1%="Welcome to the %Application% Installation Program."
SET %Message2%="This program will install the %Application% software in the directory you specify on your hard disk."
SET %Message3%="(Compuserve ID: 100105,536)||Setup is supplied with the Setup Builder|software and is the copyright of G.Plowman"
DialogBox("Welcome")
IF %ERROR% == IDCANCEL GOTO :EXIT


// Installation options
CreateDialog("OPTIONS","%Caption%",0,0,260,140)
CreateControl("GroupBox","",-1,6,6,248,110,0)
CreateControl("Icon","Setup",-1,15,20,0,0,0)
CreateControl("Text","Please make a selection from the following options:",-1,60,30,170,24,0,"MS Sans Serif",15,0,0,0)
CreateControl("CheckBox","Install the %Application% software",100,38,46,180,14,0,%Option1%)
CreateControl("CheckBox","Install Sample Objects",101,38,66,180,14,0,%Option2%)
CreateControl("CheckBox","Install General Samples",102,38,86,180,14,0,%Option3%)
CreateControl("Button","&Continue",IDOK,81,123,54,14,0)
CreateControl("Button","&Back",IDBACK,140,123,54,14,0)
CreateControl("Button","E&xit",IDCANCEL,199,123,54,14,0)
CentreDialog()
SetFocus(IDOK)
EndObject()

:BACK2
DialogBox("OPTIONS")
IF %ERROR% == IDBACK GOTO :BACK1
IF %ERROR% == IDCANCEL GOTO :EXIT
SET %Option%=0
SET %Option%=%Option% + %Option3%
SET %Option%=%Option% * 2
SET %Option%=%Option% + %Option2%
SET %Option%=%Option% * 2
SET %Option%=%Option% + %Option1%


// Sort out where to install the software
// but only if the software isn't already installed
AddChar(%InstallPath%, "\")
SET %MakeDir% = %InstallPath%
SET %Temp% = Len(%MakeDir%)
IF %Temp% > 3 SET %Temp% = %Temp% - 1
SET %MakeDir% = Left(%MakeDir%, %Temp%)
IF %Installed% == TRUE GOTO :INSTALLED


// Ask the user where to install the software
// but only if the software isn't already installed
:RETRY
SET %Message1%="The install program will copy the %Application% files into the following directory:"
DialogBox("AskPath")
IF %ERROR% == IDBACK GOTO :BACK2
IF %ERROR% == IDCANCEL GOTO :EXIT

// Create installation directory
:INSTALLED
SET %InstallDrive% = Left("%InstallPath%", 2)
AddChar(%InstallPath%, "\")
SET %MakeDir% = %InstallPath%
SET %Temp% = Len(%MakeDir%)
IF %Temp% > 3 SET %Temp% = %Temp% - 1
SET %MakeDir% = Left(%MakeDir%, %Temp%)
MkDir(%MakeDir%)
IsWriteable(%MakeDir%)
IF %ERROR% == FALSE GOTO :DIRERROR


// Save the installation directory/de-install script
IF "#INSTVER#"=="INST16" WriteProfileString("Install", "Path", "%MakeDir%", "%IniFile%")
IF "#INSTVER#"=="INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\Install", "Path", "%MakeDir%")
SET %Temp% = ""


// Upgrade the de-install if required
IF %DoUpgrade% == FALSE GOTO :NODEINSTUPG
SET %Temp% = "%DeInstall%"
SET %DeInstall% = "%WindowsDirectory%GPPSOFT\Setup.001"
GetBackupName("%DeInstall%", %DeInstall%)
IF %Installed% == FALSE GOTO :NODEINSTUPG
Open("%DeInstall%", 10, WRITE)
WriteLine(10, "//$FILES$")
Close(10)
CopyFile("%Temp%","%DeInstall%",0,1,1)
:NODEINSTUPG

SET %DoUpgrade% = ""
IF "#INSTVER#"=="INST16" WriteProfileString("Install", "DeInstallScript", "%DeInstall%", "%IniFile%")
IF "#INSTVER#"=="INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\Install", "DeInstallScript", "%DeInstall%")
IF "#INSTVER#"=="INST16" WriteProfileString("Install", "Installed", "1", "%IniFile%")
IF "#INSTVER#"=="INST32" RegWriteInt(2, "SOFTWARE\%Company%\%Application%\Install", "Installed", 1)

WriteProfileString("%Application%", "Version", "1", "DEINST.INI")
WriteProfileString("%Application%", "DeInstallScript", "%DeInstall%", "DEINST.INI")
WriteProfileString("%Application%", "Cmd", "%WindowsDirectory%GPPSOFT\#INSTVER#.EXE", "DEINST.INI")


// Create directory structure
Set %MakeDir% = "%InstallPath%OBJECTS"
MkDir("%MakeDir%")
IsWriteable(%MakeDir%)
IF %ERROR% == FALSE GOTO :DIRERROR
Set %MakeDir% = "%InstallPath%SAMPLES"
MkDir("%MakeDir%")
IsWriteable(%MakeDir%)
IF %ERROR% == FALSE GOTO :DIRERROR
Set %MakeDir% = "%InstallPath%SAMPLES\WORKSTN"
MkDir("%MakeDir%")
IsWriteable(%MakeDir%)
IF %ERROR% == FALSE GOTO :DIRERROR
Set %MakeDir% = "%InstallPath%SAMPLES\NETWORK"
MkDir("%MakeDir%")
IsWriteable(%MakeDir%)
IF %ERROR% == FALSE GOTO :DIRERROR
SET %MakeDir% = ""


// User defined code - pre file copying
// Save the install version
IF "#INSTVER#" == "INST16" WriteProfileString("Install", "Version", "5.01.006", "%IniFile%")
IF "#INSTVER#" == "INST16" WriteProfileString("Install", "DefaultBackdrop", "%InstallPath%OBJECTS\DEFAULT.BKD", "%IniFile%")
IF "#INSTVER#" == "INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\Install", "Version", "5.01.006")
IF "#INSTVER#" == "INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\Install", "DefaultBackdrop", "%InstallPath%OBJECTS\DEFAULT.BKD")

// Make the temporary directory
MkDir("%WindowsDirectory%TEMP")
IF "#INSTVER#" == "INST16" WriteProfileString("Install", "TempPath", "%WindowsDirectory%TEMP", "%IniFile%")
IF "#INSTVER#" == "INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\Install", "TempPath", "%WindowsDirectory%TEMP")

// Set the copy dialog position for small screens so that
// the user can see the cue cards
GetScreenWidth(%Width%)
IF %Width% <= 800 CentreDialog(2, 2)



// Setup the de-install procedure
OpenDeInstall("%DeInstall%")
AddDeInstall("$STARTUP$","Set ^037IniFile^037=^034BLDR16.INI^034")
AddDeInstall("$STARTUP$","Set ^037Caption^037=^034Setup^034")
AddDeInstall("$STARTUP$","Set ^037Application^037=^034Setup Builder^034")
AddDeInstall("$STARTUP$","Set ^037Company^037=^034GPPSoftware^034")
AddDeInstall("$STARTUP$","Set ^037InstallPath^037=^034%InstallPath%^034")
AddDeInstall("$STARTUP$","Set ^037InstallDrive^037=^034%InstallDrive%^034")
AddDeInstall("$STARTUP$","SetSharedRegistry(^034^037Company^037^034, ^034^037Application^037^034, ^034^037IniFile^037^034)")
AddDeInstall("$STARTUP$","MessageBox(^034The %Application% software is about to be removed from your machine.^^013^^013All files, directories and the appropriate Program Manager Group will be deleted.^^013^^013Are you sure you wish to continue ?^034, ^034%Caption%^034, MB_YESNO, MB_ICONQUESTION)")
AddDeInstall("$STARTUP$","IF %%ERROR%% == IDYES GOTO :DODELETE")
AddDeInstall("$STARTUP$","Set ^037Message1^037 = ^034De-installation aborted - the %Application% software has not been deinstalled.^034")
AddDeInstall("$STARTUP$","Set ^037Message2^037 = ^034^034")
AddDeInstall("$STARTUP$","DialogBox(^34OKBOX^34)")
AddDeInstall("$STARTUP$","GOTO :END")
AddDeInstall("$STARTUP$",":DODELETE")

AddDeInstall("$USERSCRIPT$","// Remove older version's files")
AddDeInstall("$USERSCRIPT$","Delete(^034^037WindowsDirectory^037DOSEXEC.PIF^034)")
AddDeInstall("$USERSCRIPT$","")
AddDeInstall("$USERSCRIPT$","// Remove extraneous files")
AddDeInstall("$USERSCRIPT$","Delete(^034^037InstallPath^037SAMPLES\*.*^034)")
AddDeInstall("$USERSCRIPT$","Delete(^034^037InstallPath^037SAMPLES\WORKSTN\*.*^034)")
AddDeInstall("$USERSCRIPT$","Delete(^034^037InstallPath^037SAMPLES\NETWORK\*.*^034)")
AddDeInstall("$USERSCRIPT$","Delete(^034^037InstallPath^037OBJECTS\*.*^034)")
AddDeInstall("$USERSCRIPT$","")
AddDeInstall("$USERSCRIPT$","Delete(^034^037WindowsDirectory^037BUILDER.INI^034)")
AddDeInstall("$USERSCRIPT$","Delete(^034^037InstallPath^037BUILDER.EXE^034)")
AddDeInstall("$USERSCRIPT$","Delete(^034^037InstallPath^037INST.EXE^034)")
AddDeInstall("$USERSCRIPT$","Delete(^034^037InstallPath^037SETUP.SCR^034)")
AddDeInstall("$USERSCRIPT$","Delete(^034^037InstallPath^037LADMIN.EXE^034)")
AddDeInstall("$USERSCRIPT$","Delete(^034^037InstallPath^037DIBAPI.DLL^034)")
AddDeInstall("$USERSCRIPT$","Delete(^034^037InstallPath^037DIBAPI16.DLL^034)")
AddDeInstall("$USERSCRIPT$","Delete(^034^037InstallPath^037TS.HLP^034)")
AddDeInstall("$USERSCRIPT$","")
AddDeInstall("$USERSCRIPT$","// Help file .GID files")
AddDeInstall("$USERSCRIPT$","SetFileAttr(^034^037InstallPath^037BUILDER.GID^034, 0, 0, 0, 0)")
AddDeInstall("$USERSCRIPT$","SetFileAttr(^034^037InstallPath^037SETUP.GID^034, 0, 0, 0, 0)")
AddDeInstall("$USERSCRIPT$","SetFileAttr(^034^037InstallPath^037TS.GID^034, 0, 0, 0, 0)")
AddDeInstall("$USERSCRIPT$","Delete(^034^037InstallPath^037*.GID^034)")
AddDeInstall("$USERSCRIPT$","")
AddDeInstall("$USERSCRIPT$","// Finally file manager item")
AddDeInstall("$USERSCRIPT$","IF ^034^094035INSTVER^094035^034 == ^034INST16^034 WriteProfileString(^034Extensions^034, ^034inf^034, ^034^034, ^034WIN.INI^034)")
AddDeInstall("$USERSCRIPT$","IF ^034^094035INSTVER^094035^034 == ^034INST16^034 WriteProfileString(^034Extensions^034, ^034scr^034, ^034^034, ^034WIN.INI^034)")


// Cleanup de-install script
AddDeInstall("$DIRECTORIES$","RmDir(^034%InstallPath%SAMPLES\NETWORK^034)")
AddDeInstall("$DIRECTORIES$","RmDir(^034%InstallPath%SAMPLES\WORKSTN^034)")
AddDeInstall("$DIRECTORIES$","RmDir(^034%InstallPath%SAMPLES^034)")
AddDeInstall("$DIRECTORIES$","RmDir(^034%InstallPath%OBJECTS^034)")
AddDeInstall("$CLEANUP$","SET ^037Len^037 = Len(^034^037InstallPath^037^034) - 1")
AddDeInstall("$CLEANUP$","SET ^037InstTemp^037 = Left(^034^037InstallPath^037^034, ^037Len^037)")
AddDeInstall("$CLEANUP$","RmDir(^034^037InstTemp^037^034)")
AddDeInstall("$CLEANUP$","Delete(^034%WindowsDirectory%%IniFile%^034)")
AddDeInstall("$CLEANUP$","IF ^34^35^35INSTVER^35^35^34==^34INST32^34 RegDeleteSetting(2, ^34SOFTWARE\%Company%\%Application%^34, ^34^34)")
AddDeInstall("$CLEANUP$","SET ^037Message1^037 = ^034The %Application% software has been successfully de-installed.^034")
AddDeInstall("$CLEANUP$","SET ^037Message2^037 = ^034To re-install the %Application% software you should re-run this installation program.^034")
AddDeInstall("$CLEANUP$","DialogBox(^34OKBOX^34)")
AddDeInstall("$CLEANUP$","WriteProfileString(^34%Application%^34,^34Continue^34,^0341^34,^34DEINST.INI^34)")
AddDeInstall("$CLEANUP$",":END")


// Check for space availability
GetDiskSpace(%InstallDrive%)
SET %Space%=%ERROR%
SET %Required%=51200
IF %Option1%==TRUE SET %Required%=%Required% + 2862080
IF %Option2%==TRUE SET %Required%=%Required% + 65536
IF %Option3%==TRUE SET %Required%=%Required% + 118784
IF %Space% >= %Required% GOTO :GOTSPACE
MessageBox("The %Application% software requires %Required% bytes of disk space and there is only %Space% bytes free on your %InstallDrive% drive.||Do you wish to continue to install the software ?", "%Caption%", MB_YESNO, MB_ICONQUESTION)
IF %ERROR% == IDNO GOTO :EXIT
:GOTSPACE


// Do the file copying
SET %TotalBlocks%=0
IF %Option% AND 1 != 0 SET %TotalBlocks% = %TotalBlocks% + 23
IF %Option% AND 2 != 0 SET %TotalBlocks% = %TotalBlocks% + 11
IF %Option% AND 4 != 0 SET %TotalBlocks% = %TotalBlocks% + 12
CopyFile(%TotalBlocks%)
Release()
IF %Option% AND 1==0 GOTO :OVER1
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SETUP.EXE^034)")
ShowCueCard("WELCOMECARD")
"SETUP.EXE", "%InstallPath%", "Copying: Interpreter Executable", TRUE
:OVER1
Release()
IF %Option% AND 1==0 GOTO :OVER2
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%INST16.EXE^034)")
"INST16.EX_", "%InstallPath%INST16.EXE", "Copying: 16-bit Interpreter Executable", TRUE
:OVER2
Release()
IF %Option% AND 1==0 GOTO :OVER3
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%INST32.EXE^034)")
"INST32.EX_", "%InstallPath%INST32.EXE", "Copying: 32-bit Interpreter Executable", TRUE
:OVER3
Release()
IF %Option% AND 1==0 GOTO :OVER4
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%CLEANUP.EXE^034)")
ShowCueCard("PROMO1")
"CLEANUP.EXE", "%InstallPath%", "Copying: Interpreter Executable", TRUE
:OVER4
Release()
IF %Option% AND 1==0 GOTO :OVER5
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%DEINST.EXE^034)")
"DEINST.EXE", "%InstallPath%", "Copying: De-Installer Executable", TRUE
:OVER5
Release()
IF %Option% AND 1==0 GOTO :OVER6
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%BLDR16.EXE^034)")
"BLDR16.EX_", "%InstallPath%BLDR16.EXE", "Copying: Setup Builder 16-bit Executable", TRUE
:OVER6
Release()
IF %Option% AND 1==0 GOTO :OVER7
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%BLDR32.EXE^034)")
"BLDR32.ex_", "%InstallPath%BLDR32.EXE", "Copying: Setup Builder 32-bit Executable", TRUE
:OVER7
Release()
IF %Option% AND 1==0 GOTO :OVER8
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%BUILDER.HLP^034)")
ShowCueCard("PROMO2")
"BUILDER.HL_", "%InstallPath%BUILDER.HLP", "Copying: Setup Builder Help File", TRUE
:OVER8
Release()
IF %Option% AND 1==0 GOTO :OVER9
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SETUP.HLP^034)")
"SETUP.HL_", "%InstallPath%SETUP.HLP", "Copying: Setup Script Language Help File", TRUE
:OVER9
Release()
IF %Option% AND 1==0 GOTO :OVER10
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%COMPRESS.EXE^034)")
"COMPRESS.EX_", "%InstallPath%COMPRESS.EXE", "Copying: Compression Utility", TRUE
:OVER10
Release()
IF %Option% AND 1==0 GOTO :OVER11
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%COMPRESS.TXT^034)")
"COMPRESS.TX_", "%InstallPath%COMPRESS.TXT", "Copying: Compression Utility", TRUE
:OVER11
Release()
IF %Option% AND 1==0 GOTO :OVER12
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%DOSEXEC.PIF^034)")
"DOSEXEC.PIF", "%InstallPath%", "Copying: PIF File", TRUE
:OVER12
Release()
IF %Option% AND 1==0 GOTO :OVER13
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%INSTRUN.PIF^034)")
"INSTRUN.PIF", "%InstallPath%", "Copying: PIF File", TRUE
:OVER13
SET %Skip%=0
Release()
IF %Option% AND 1==0 GOTO :OVER14
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
SET %Skip%=1
SetGaugeText("Copying: Third Party Components Configuration File", "%CurrentDirectory%IMPORT.IN_", "%InstallPath%IMPORT.INI")
ConfirmOverwrite("%InstallPath%IMPORT.INI", "%CurrentDirectory%IMPORT.IN_", "", 0)
IF %ERROR% == IDNO GOTO :OVER14
AddDeInstall("$FILES$","Delete(^034%InstallPath%IMPORT.INI^034)")
"IMPORT.IN_", "%InstallPath%IMPORT.INI", "Copying: Third Party Components Configuration File", TRUE
SET %Skip%=0
:OVER14
UpdateGauge(%Skip%)
Release()
IF %Option% AND 1==0 GOTO :OVER15
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%PRNT.BAT^034)")
"PRNT.BAT", "%InstallPath%", "Copying: Registration Support File", TRUE
:OVER15
Release()
IF %Option% AND 1==0 GOTO :OVER16
CheckExists("%CurrentDrive%DISK01", "Please insert the diskette labelled 'DISK01'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%LADMIN16.EXE^034)")
ShowCueCard("PROMO3")
"LADMIN16.EX_", "%InstallPath%LADMIN16.EXE", "Copying: License Administration Utility", TRUE
:OVER16
Release()
IF %Option% AND 1==0 GOTO :OVER17
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%LADMIN32.EXE^034)")
"LADMIN32.EX_", "%InstallPath%LADMIN32.EXE", "Copying: License Administration Utility", TRUE
:OVER17
Release()
IF %Option% AND 1==0 GOTO :OVER18
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%ORDERAUS.TXT^034)")
"ORDERAUS.TXT", "%InstallPath%", "Copying: Supporting Documentation", TRUE
:OVER18
Release()
IF %Option% AND 1==0 GOTO :OVER19
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%ORDERUK.TXT^034)")
"ORDERUK.TXT", "%InstallPath%", "Copying: Supporting Documentation", TRUE
:OVER19
Release()
IF %Option% AND 1==0 GOTO :OVER20
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%COMMENTS.TXT^034)")
"COMMENTS.TXT", "%InstallPath%", "Copying: Supporting Documentation", TRUE
:OVER20
Release()
IF %Option% AND 1==0 GOTO :OVER21
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%INSTALL.TXT^034)")
"INSTALL.TXT", "%InstallPath%", "Copying: Supporting Documentation", TRUE
:OVER21
Release()
IF %Option% AND 1==0 GOTO :OVER22
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%README.TXT^034)")
"README.TXT", "%InstallPath%", "Copying: Supporting Documentation", TRUE
:OVER22
Release()
IF %Option% AND 1==0 GOTO :OVER23
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%FILE_ID.DIZ^034)")
ShowCueCard("PROMO4")
"FILE_ID.DIZ", "%InstallPath%", "Copying: Supporting Documentation", TRUE
:OVER23
Release()
IF %Option% AND 2==0 GOTO :OVER24
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%OBJECTS\ASKPATH.DLG^034)")
"ASKPATH.DLG", "%InstallPath%OBJECTS\", "Copying: Object Files", TRUE
:OVER24
Release()
IF %Option% AND 2==0 GOTO :OVER25
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%OBJECTS\COPYRITE.DLG^034)")
"COPYRITE.DLG", "%InstallPath%OBJECTS\", "Copying: Object Files", TRUE
:OVER25
Release()
IF %Option% AND 2==0 GOTO :OVER26
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%OBJECTS\DEFAULT.BKD^034)")
"DEFAULT.BKD", "%InstallPath%OBJECTS\", "Copying: Object Files", TRUE
:OVER26
Release()
IF %Option% AND 2==0 GOTO :OVER27
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%OBJECTS\DEFAULT.CUE^034)")
"DEFAULT.CUE", "%InstallPath%OBJECTS\", "Copying: Object Files", TRUE
:OVER27
Release()
IF %Option% AND 2==0 GOTO :OVER28
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%OBJECTS\DEINSTAL.DLG^034)")
"DEINSTAL.DLG", "%InstallPath%OBJECTS\", "Copying: Object Files", TRUE
:OVER28
Release()
IF %Option% AND 2==0 GOTO :OVER29
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%OBJECTS\DIALOG1.DLG^034)")
"DIALOG1.DLG", "%InstallPath%OBJECTS\", "Copying: Object Files", TRUE
:OVER29
Release()
IF %Option% AND 2==0 GOTO :OVER30
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%OBJECTS\DIALOG2.DLG^034)")
"DIALOG2.DLG", "%InstallPath%OBJECTS\", "Copying: Object Files", TRUE
:OVER30
Release()
IF %Option% AND 2==0 GOTO :OVER31
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%OBJECTS\LICENSE.DLG^034)")
"LICENSE.DLG", "%InstallPath%OBJECTS\", "Copying: Object Files", TRUE
:OVER31
Release()
IF %Option% AND 2==0 GOTO :OVER32
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%OBJECTS\OKBOX.DLG^034)")
"OKBOX.DLG", "%InstallPath%OBJECTS\", "Copying: Object Files", TRUE
:OVER32
Release()
IF %Option% AND 2==0 GOTO :OVER33
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%OBJECTS\REGISTER.CUE^034)")
"REGISTER.CUE", "%InstallPath%OBJECTS\", "Copying: Object Files", TRUE
:OVER33
Release()
IF %Option% AND 2==0 GOTO :OVER34
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%OBJECTS\WELCOME.DLG^034)")
"WELCOME.DLG", "%InstallPath%OBJECTS\", "Copying: Object Files", TRUE
:OVER34
Release()
IF %Option% AND 4==0 GOTO :OVER35
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SAMPLES\DIAMOND.BMP^034)")
ShowCueCard("PROMO5")
"DIAMOND.BMP", "%InstallPath%SAMPLES\", "Copying: Sample Files", TRUE
:OVER35
Release()
IF %Option% AND 4==0 GOTO :OVER36
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SAMPLES\PANEL.BMP^034)")
"PANEL.BMP", "%InstallPath%SAMPLES\", "Copying: Sample Files", TRUE
:OVER36
Release()
IF %Option% AND 4==0 GOTO :OVER37
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SAMPLES\ROUNDPT.BMP^034)")
"ROUNDPT.BMP", "%InstallPath%SAMPLES\", "Copying: Sample Files", TRUE
:OVER37
Release()
IF %Option% AND 4==0 GOTO :OVER38
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SAMPLES\SAMPLE1.SPJ^034)")
"SAMPLE1.SPJ", "%InstallPath%SAMPLES\", "Copying: Sample Files", TRUE
:OVER38
Release()
IF %Option% AND 4==0 GOTO :OVER39
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SAMPLES\SAMPLE2.SPJ^034)")
"SAMPLE2.SPJ", "%InstallPath%SAMPLES\", "Copying: Sample Files", TRUE
:OVER39
Release()
IF %Option% AND 4==0 GOTO :OVER40
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SAMPLES\SAMPLE3.INI^034)")
"SAMPLE3.INI", "%InstallPath%SAMPLES\", "Copying: Sample Files", TRUE
:OVER40
Release()
IF %Option% AND 4==0 GOTO :OVER41
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SAMPLES\SAMPLE3.SCR^034)")
"SAMPLE3.SCR", "%InstallPath%SAMPLES\", "Copying: Sample Files", TRUE
:OVER41
Release()
IF %Option% AND 4==0 GOTO :OVER42
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SAMPLES\SAMPLE4.SCR^034)")
"SAMPLE4.SCR", "%InstallPath%SAMPLES\", "Copying: Sample Files", TRUE
:OVER42
Release()
IF %Option% AND 4==0 GOTO :OVER43
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SAMPLES\SQUAREPT.BMP^034)")
"SQUAREPT.BMP", "%InstallPath%SAMPLES\", "Copying: Sample Files", TRUE
:OVER43
Release()
IF %Option% AND 4==0 GOTO :OVER44
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SAMPLES\NETWORK.SPJ^034)")
"NETWORK.SPJ", "%InstallPath%SAMPLES\", "Copying: Sample Files", TRUE
:OVER44
Release()
IF %Option% AND 4==0 GOTO :OVER45
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SAMPLES\WORKSTN.SPJ^034)")
"WORKSTN.SPJ", "%InstallPath%SAMPLES\", "Copying: Sample Files", TRUE
:OVER45
Release()
IF %Option% AND 4==0 GOTO :OVER46
CheckExists("%CurrentDrive%DISK02", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDCANCEL GOTO :EXIT
AddDeInstall("$FILES$","Delete(^034%InstallPath%SAMPLES\SETUP.SPJ^034)")
"SETUP.SPJ", "%InstallPath%SAMPLES\", "Copying: Sample Files", TRUE
:OVER46
EndCopyFile()
ShowCueCard("")




// User defined code - post file copying
// Reset dialog centering
CentreDialog(3, 3)

// License - check for old versions first
GetProfileString("License", "Registration", "", "BUILDER.INI", %LStr%)
IF "%LStr%" == "" GOTO :NOBUILDER
IF "#INSTVER#" == "INST16" WriteProfileString("License", "Registration", "%LStr%", "%IniFile%")
IF "#INSTVER#" == "INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\License", "Registration", "%LStr%")
:NOBUILDER
IF "#INSTVER#" == "INST16" GetProfileString("License", "Registration", "", "%IniFile%", %LStr%)
IF "#INSTVER#" == "INST32" RegGetSetting(2, "SOFTWARE\%Company%\%Application%\License", "Registration", "", %LStr%)
IF "%LStr%" != "" GOTO :GOTIT
GetLicense(%License%)
IF "#INSTVER#" == "INST16" WriteProfileString("License", "Registration", "%License%", "%IniFile%")
IF "#INSTVER#" == "INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\License", "Registration", "%License%")
:GOTIT

// Tell Setup Builder where to find some files for creating install disks
IF "#INSTVER#" == "INST16" WriteProfileString("Executables", "Setup", "%InstallPath%setup.exe", "%IniFile%")
IF "#INSTVER#" == "INST16" WriteProfileString("Executables", "DeInstall", "%InstallPath%deinst.exe", "%IniFile%")
IF "#INSTVER#" == "INST16" WriteProfileString("Executables", "Inst16", "%InstallPath%inst16.exe", "%IniFile%")
IF "#INSTVER#" == "INST16" WriteProfileString("Executables", "Inst32", "%InstallPath%inst32.exe", "%IniFile%")
IF "#INSTVER#" == "INST16" WriteProfileString("Executables", "Cleanup", "%InstallPath%cleanup.exe", "%IniFile%")
IF "#INSTVER#" == "INST16" WriteProfileString("Executables", "InstRun", "%InstallPath%instrun.pif", "%IniFile%")
IF "#INSTVER#" == "INST16" WriteProfileString("Install", "ImportList", "%InstallPath%IMPORT.INI", "%IniFile%")
IF "#INSTVER#" == "INST16" WriteProfileString("Application", "WinExecWait", "0", "%IniFile%")

IF "#INSTVER#" == "INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\Executables", "Setup", "%InstallPath%setup.exe")
IF "#INSTVER#" == "INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\Executables", "DeInstall", "%InstallPath%deinst.exe")
IF "#INSTVER#" == "INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\Executables", "Inst16", "%InstallPath%inst16.exe")
IF "#INSTVER#" == "INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\Executables", "Inst32", "%InstallPath%inst32.exe")
IF "#INSTVER#" == "INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\Executables", "Cleanup", "%InstallPath%cleanup.exe")
IF "#INSTVER#" == "INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\Executables", "InstRun", "%InstallPath%instrun.pif")
IF "#INSTVER#" == "INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\Install", "ImportList", "%InstallPath%IMPORT.INI")
IF "#INSTVER#" == "INST32" RegWriteInt(2, "SOFTWARE\%Company%\%Application%\Application", "WinExecWait", 0)

// Delete the old DOSEXEC.PIF to fix compression errors
Delete("%WindowsDirectory%DOSEXEC.PIF")

// Delete old import file
Delete("%WindowsDirectory%IMPORT.INI")


// Now setup a new program manager group and its icons
MessageBox("Setup can create a Program Manager group|for the %Application% application.||Do you wish to create a Program|Manager group and icons ?", "%Caption%", MB_YESNO, MB_ICONQUESTION)
Set %PmGrp% = %Error%
IF %ERROR% == IDNO GOTO :NOPMGROUP

MakeGroup("%Application%", "")
IF %Option% AND 1 != 0 MakeIcon("Setup Builder (16-bit)", "%InstallPath%BLDR16.EXE", "")
IF %Option% AND 1 != 0 MakeIcon("Setup Builder (32-bit)", "%InstallPath%BLDR32.EXE", "")
IF %Option% AND 1 != 0 MakeIcon("Setup Builder Help", "%InstallPath%BUILDER.HLP", "")
IF %Option% AND 1 != 0 MakeIcon("Setup Script Help", "%InstallPath%SETUP.HLP", "")
IF %Option% AND 1 != 0 MakeIcon("Install Notes", "%InstallPath%INSTALL.TXT", "")
IF %Option% AND 1 != 0 MakeIcon("ReadMe", "%InstallPath%README.TXT", "")
AddDeInstall("$PMGROUP$","DeleteGroup(^034%Application%^034)")
:NOPMGROUP


// Licensing
:LICENSING
IF "%IniFile%" == "" SET %IniFile%="Setup Builder.INI"
IF "#INSTVER#"=="INST16" GetProfileString("License","UserName","","%IniFile%",%EF_1%)
IF "#INSTVER#"=="INST16" GetProfileString("License","Company","","%IniFile%",%EF_2%)
IF "#INSTVER#"=="INST32" RegGetSetting(2, "SOFTWARE\%Company%\%Application%\License", "UserName", "", %EF_1%)
IF "#INSTVER#"=="INST32" RegGetSetting(2, "SOFTWARE\%Company%\%Application%\License". "Company", "", %EF_2%)
SET %Message1% = "Please enter the following licensing information for the %Application% software:"
DialogBox("License")
IF %ERROR% == IDCANCEL GOTO :EXIT
IF "#INSTVER#"=="INST16" WriteProfileString("License","UserName","%EF_1%","%IniFile%")
IF "#INSTVER#"=="INST16" WriteProfileString("License","Company","%EF_2%","%IniFile%")
IF "#INSTVER#"=="INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\License", "UserName", "%EF_1%")
IF "#INSTVER#"=="INST32" RegWriteSetting(2, "SOFTWARE\%Company%\%Application%\License". "Company", "%EF_2%")


// User defined code - post PM group creation
// Create some extra icons
IF %PmGrp% == IDNO GOTO :NOICONS
IF "#INSTVER#" == "INST16" MakeIcon("License Administrator", "%InstallPath%LADMIN16.EXE", "%IniFile%")
IF "#INSTVER#" == "INST32" MakeIcon("License Administrator", "%InstallPath%LADMIN32.EXE", "%Application%")
MakeIcon("Australian Order Form", "%InstallPath%PRNT.BAT", "%InstallPath%ORDERAUS.TXT")
MakeIcon("UK Order Form", "%InstallPath%PRNT.BAT", "%InstallPath%ORDERUK.TXT")
MakeIcon("Setup", "%CurrentDrive%\SETUP.EXE", "", "%InstallPath%SETUP.EXE")
MakeIcon("Install", "%CurrentDrive%\INSTALL.EXE", "", "%InstallPath%SETUP.EXE")
MakeIcon("De-Installer", "%WindowsDirectory%GPPSOFT\DEINST.EXE")

// Delete unwanted icons
DeleteIcon("Setup Builder")    // Remove old icon
IF "#INSTVER#" == "INST16" DeleteIcon("Setup Builder (32-bit)")
IF "#INSTVER#" == "INST32" DeleteIcon("Setup Builder (16-bit)")
:NOICONS

// File association - Windows 3.x only
IF "#INSTVER#" == "INST32" GOTO :NOASSOC
MessageBox("Setup can install a file association|for File Manager with .SCR and .INF files.||Do you wish to install this association ?", "%Caption%", MB_YESNO, MB_ICONQUESTION)
IF %ERROR% == IDNO GOTO :NOASSOC
IF "#INSTVER#" == "INST16" WriteProfileString("Extensions", "inf", "%InstallPath%inst16.exe ^.inf", "WIN.INI")
IF "#INSTVER#" == "INST16" WriteProfileString("Extensions", "scr", "%InstallPath%inst16.exe ^.scr", "WIN.INI")
:NOASSOC


// Create the de-install icon
IF %PmGrp% == IDYES MakeIcon("Un-Install %Application%", "%WindowsDirectory%GPPSOFT\DEINST.EXE", "%Application%")


// Done
:SUCCESS
SET %Message1%="|%Application% installation has been successfully completed."
SET %Message2%=""
DialogBox("OkBox")


// User defined code - installation completion
MessageBox("Do you wish to view the|extra installation notes ?", "%Caption%", MB_YESNO, MB_ICONQUESTION)
IF %ERROR% == IDNO GOTO :NONOTES

WinExec("notepad.exe %InstallPath%README.TXT")
:NONOTES

GOTO :END


// User decided to quit
:EXIT
EndCopyFile()
SET %Message1%="Installation has been terminated. You should re-run this installation program at a later time to install %Application%."
SET %Message2%="|The %Application% software has not been installed."
DialogBox("OkBox")
GOTO :END


// Error
:ERROR
EndCopyFile()
SET %Message1%="An error occured during installation of the %Application% software."
SET %Message2%="|The %Application% software has not been fully installed."
DialogBox("OkBox")
GOTO :END


// Failed to create install directory
:DIRERROR
SET %Message1%="|Failed to create the installation directory '%MakeDir%'."
SET %Message2%="|Unable to install the %Application% software in the specified directory."
DialogBox("OkBox")
GOTO :RETRY


:END
// Delete all the bitmaps
Delete("%WindowsDirectory%TEMP\GPSOFT3.BMP")
Delete("%WindowsDirectory%TEMP\DIAMOND.BMP")


// Final tidy up - close files and remove components from H/D
CloseDeInstall()
Close()
CheckExists("%CurrentDirectory%CLEANUP.EXE", "Please insert the diskette labelled 'DISK02'")
IF %ERROR% == IDOK WinExec("%CurrentDirectory%CLEANUP.EXE")
