I just tend to use one level and I have a lot of other stuff to finish...
Here is the code if you want to add to it:
Rem Project: Installer_Builder
Rem Created: 25/01/2010 09:36:26
Rem ***** Main Source File *****
REM Blue Gui
startBlue "","" `<<--use your Blue GUI codes here!!
set window layout 0,0,0
resetMainWindow
REM spooky's code to get windows drive location
#constant CSIDL_WINDOWS = 0x0024
` which memlock and dll numbers to use
global getpath_memblock_a = 1
global getpath_memblock_b = 2
global getpath_dll = 1
drive$ = mid$(getpath(CSIDL_WINDOWS),1)
REM Fonts
d3d_font 1, "MS Reference Sans Serif", 14, 0, 0, 1
d3d_font 2, "Microsoft Sans Serif", 9, 0, 0, 1
d3d_font 3, "Microsoft Sans Serif", 9, 1, 0, 1
REM load images
load image "BG01.png", 1
load image "BG02.png", 2
load image "BG03.png", 3
load image "BG04.png", 4
REM set globals
global BG=1
global stage = 1
global exe$ = ""
global NextButton
global CancelButton
global LicenseBox
REM Blue Gui
NextButton=createButton(280,325, 80,25, "Next", 0, 0)
setGadgetVisible NextButton, 0
paste image BG, 0,0
sync
CancelButton=createButton(380,325, 80,25, "Cancel", 0, 0)
setGadgetVisible CancelButton, 0
paste image BG, 0,0
sync
BackButton=createButton(190,325, 80,25, "Back", 0, 0)
setGadgetVisible BackButton, 0
paste image BG, 0,0
sync
BrowseButton=createButton(375,120, 80,25, "Browse...", 0, 0)
setGadgetVisible BrowseButton, 0
paste image BG, 0,0
sync
InstallButton=createButton(280,325, 80,25, "Install", 0, 0)
setGadgetVisible InstallButton, 0
paste image BG, 0,0
sync
FinishButton=createButton(380,325, 80,25, "Finish", 0, 0)
setGadgetVisible FinishButton, 0
paste image BG, 0,0
sync
LicenseBox=createEdit(50,100, 380,160, 1, 0)
setReadOnly LicenseBox, 1
GOSUB _License
Dest$ = drive$ + ":\Program Files\" + exe$ + "\"
setSelText LicenseBox, License$
setGadgetVisible LicenseBox, 0
paste image BG, 0,0
sync
BrowseBox=createEdit(25,120, 350,25, 0, 0)
setSelText BrowseBox, Dest$
setGadgetVisible BrowseBox, 0
paste image BG, 0,0
sync
agree=createRadioButton(100,265, 200,20, "I accept the agreement", 0)
setGadgetVisible agree, 0
setchecked agree, 1
dnagree=createRadioButton(100,285, 200,20, "I do not accept the agreement", 0)
setGadgetVisible dnagree, 0
setchecked agree, 0
paste image BG, 0,0
sync
ShortCheck=createCheckBox(50,150, 200, 20, "Create a desktop icon", 0)
setChecked ShortCheck, 1
setGadgetVisible ShortCheck, 0
paste image BG, 0,0
sync
lnch$="Launch " + exe$
LaunchCheck=createCheckBox(30,330, 200, 20, lnch$, 0)
setChecked LaunchCheck, 1
setGadgetVisible LaunchCheck, 0
paste image BG, 0,0
sync
`--------------------------------------------- MAIN LOOP START
DO
getEvent
if eventSource()=NextButton and eventType()=MOUSE_CLICK
inc stage
inc BG
if BG = 5 then BG = 4
Dest$ = getGadgetText(BrowseBox)
endif
if eventSource()=CancelButton and eventType()=MOUSE_CLICK
result=questionMessage("Do you really want to quit Setup?", "Quit?")
if result=1
minimise window mainwindow()
deleteGadget NextButton
deleteGadget CancelButton
deleteGadget LicenseBox
deleteGadget agree
deleteGadget dnagree
deleteGadget BrowseButton
deleteGadget BrowseBox
deleteGadget ShortCheck
deleteGadget InstallButton
deleteGadget FinishButton
deleteGadget LaunchCheck
paste image BG, 0,0
sync
end
endif
endif
if eventSource()=BackButton and eventType()=MOUSE_CLICK
if stage = 3 then stage = 1 : BG = 1
if stage = 4 then stage = 2 : BG = 2
if stage = 5 then stage = 4 : BG = 3
if stage = 6 then stage = 5 : BG = 2
endif
if eventSource()=InstallButton and eventType()=MOUSE_CLICK
stage = 7
BG = 2
endif
if eventSource()=BrowseButton and eventType()=MOUSE_CLICK
setSelStart BrowseBox, 0
setSelLen BrowseBox, len(Dest$)
Dest$=folderDialog()
setSelText BrowseBox, Dest$
endif
if eventSource()=FinishButton and eventType()=MOUSE_CLICK
minimise window mainwindow()
deleteGadget NextButton
deleteGadget CancelButton
deleteGadget LicenseBox
deleteGadget agree
deleteGadget dnagree
deleteGadget BrowseButton
deleteGadget BrowseBox
deleteGadget ShortCheck
deleteGadget InstallButton
deleteGadget FinishButton
paste image BG, 0,0
sync
if getChecked(LaunchCheck)
exefile$ = Dest$ + exe$ + ".exe"
execute file exefile$,"",""
nice wait 1000
endif
deleteGadget LaunchCheck
paste image BG, 0,0
sync
end
endif
if eventSource()=agree and eventType()=MOUSE_CLICK
setGadgetEnabled NextButton, 1
endif
if eventSource()=dnagree and eventType()=MOUSE_CLICK
setGadgetEnabled NextButton, 0
endif
paste image BG, 0,0
set cursor 0,50
if stage = 1
REM Show startup text
l1$ = "Welcome to the Setup Wizard"
l2$ = "for " + exe$
l3$ = "This will install " + exe$
l4$ = "on your computer."
l5$ = "It is recommended that you close all other"
l6$ = "applications before continuing."
l7$ = "Click Next to continue, or Cancel to exit Setup."
d3d_starttext
d3d_text 1, 160, 10, 0, l1$, RGB(0,0,0)
d3d_text 1, 160, 35, 0, l2$, RGB(0,0,0)
d3d_text 2, 160, 80, 0, l3$, RGB(0,0,0)
d3d_text 2, 160, 100, 0, l4$, RGB(0,0,0)
d3d_text 2, 160, 140, 0, l5$, RGB(0,0,0)
d3d_text 2, 160, 160, 0, l6$, RGB(0,0,0)
d3d_text 2, 160, 200, 0, l7$, RGB(0,0,0)
d3d_endtext
setGadgetVisible NextButton, 1
setGadgetVisible CancelButton, 1
setGadgetVisible BackButton, 0
setGadgetVisible LicenseBox, 0
setGadgetVisible agree, 0
setGadgetVisible dnagree, 0
setGadgetVisible BrowseButton, 0
setGadgetVisible BrowseBox, 0
setGadgetVisible ShortCheck, 0
setGadgetVisible InstallButton, 0
setGadgetVisible FinishButton, 0
setGadgetVisible LaunchCheck, 0
setGadgetEnabled NextButton, 1
endif
if stage = 2
REM setup license page
setGadgetVisible NextButton, 1
setGadgetVisible CancelButton, 1
setGadgetVisible BackButton, 1
setGadgetVisible BrowseButton, 0
setchecked agree, 0
setchecked dnagree, 1
setGadgetVisible LicenseBox, 1
setGadgetVisible agree, 1
setGadgetVisible dnagree, 1
setGadgetEnabled NextButton, 0
setSelStart LicenseBox, 0
setGadgetVisible BrowseBox, 0
setGadgetVisible ShortCheck, 0
setGadgetVisible InstallButton, 0
setGadgetVisible FinishButton, 0
setGadgetVisible LaunchCheck, 0
stage = 3
endif
if stage = 3
REM License Agreement
l1$ = "License Agreement"
l2$ = "Please read the following important information before continuing."
l3$ = "Please read the following license agreement. You must accept the terms of this"
l4$ = "agreement before continuing with the installation."
d3d_starttext
d3d_text 3, 10, 10, 0, l1$, RGB(0,0,0)
d3d_text 2, 10, 25, 0, l2$, RGB(0,0,0)
d3d_text 2, 30, 60, 0, l3$, RGB(0,0,0)
d3d_text 2, 30, 75, 0, l4$, RGB(0,0,0)
d3d_endtext
endif
if stage = 4
REM Destination
l1$ = "Select Destination Location"
l2$ = "Where should " + exe$ + " be installed?"
l3$ = "Setup will install " + exe$ + " into the following folder."
l4$ = "To continue, click Next. If you would like to select a different folder, click Browse."
d3d_starttext
d3d_text 3, 10, 10, 0, l1$, RGB(0,0,0)
d3d_text 2, 10, 25, 0, l2$, RGB(0,0,0)
d3d_text 2, 70, 80, 0, l3$, RGB(0,0,0)
d3d_text 2, 25, 125, 0, l4$, RGB(0,0,0)
d3d_endtext
setGadgetVisible NextButton, 1
setGadgetVisible CancelButton, 1
setGadgetVisible BackButton, 1
setGadgetVisible LicenseBox, 0
setGadgetVisible agree, 0
setGadgetVisible dnagree, 0
setGadgetVisible BrowseButton, 1
setGadgetVisible BrowseBox, 1
setGadgetVisible ShortCheck, 0
setGadgetVisible InstallButton, 0
setGadgetVisible FinishButton, 0
setGadgetVisible LaunchCheck, 0
endif
if stage = 5
REM Shortcut
l1$ = "Select Additional Tasks"
l2$ = "Which additional tasks should be performed?"
l3$ = "Select the additional tasks you would like Setup to perform while installing"
l4$ = exe$ + ", then click Next."
l5$ = "Additional icons:"
d3d_starttext
d3d_text 3, 10, 10, 0, l1$, RGB(0,0,0)
d3d_text 2, 10, 25, 0, l2$, RGB(0,0,0)
d3d_text 2, 30, 75, 0, l3$, RGB(0,0,0)
d3d_text 2, 30, 90, 0, l4$, RGB(0,0,0)
d3d_text 2, 30, 120, 0, l5$, RGB(0,0,0)
d3d_endtext
setGadgetVisible NextButton, 1
setGadgetVisible CancelButton, 1
setGadgetVisible BackButton, 1
setGadgetVisible LicenseBox, 0
setGadgetVisible agree, 0
setGadgetVisible dnagree, 0
setGadgetVisible BrowseButton, 0
setGadgetVisible BrowseBox, 0
setGadgetVisible ShortCheck, 1
setGadgetVisible InstallButton, 0
setGadgetVisible FinishButton, 0
setGadgetVisible LaunchCheck, 0
endif
if stage = 6
REM Ready to install
l1$ = "Ready to Install"
l2$ = "Setup is now ready to begin installing " + exe$ + "."
l3$ = "Click Install to continue with the installation, or click Back if"
l4$ = "you want to change any settings."
d3d_starttext
d3d_text 3, 10, 10, 0, l1$, RGB(0,0,0)
d3d_text 2, 10, 25, 0, l2$, RGB(0,0,0)
d3d_text 2, 30, 70, 0, l3$, RGB(0,0,0)
d3d_text 2, 30, 85, 0, l4$, RGB(0,0,0)
d3d_endtext
l5$ = "Destination location:"
l6$ = Dest$
d3d_starttext
d3d_text 2, 31, 117, 0, l5$, RGB(0,0,0)
d3d_text 2, 41, 132, 0, l6$, RGB(0,0,0)
d3d_endtext
if getChecked(ShortCheck)
l7$ = "Additional Tasks:"
l8$ = "Additional icons:"
l9$ = "Create a desktop icon"
d3d_starttext
d3d_text 2, 31, 162, 0, l7$, RGB(0,0,0)
d3d_text 2, 41, 177, 0, l8$, RGB(0,0,0)
d3d_text 2, 51, 192, 0, l9$, RGB(0,0,0)
d3d_endtext
endif
setGadgetVisible NextButton, 0
setGadgetVisible CancelButton, 1
setGadgetVisible BackButton, 1
setGadgetVisible LicenseBox, 0
setGadgetVisible agree, 0
setGadgetVisible dnagree, 0
setGadgetVisible BrowseButton, 0
setGadgetVisible BrowseBox, 0
setGadgetVisible ShortCheck, 0
setGadgetVisible InstallButton, 1
setGadgetVisible InstallBox, 1
setGadgetVisible FinishButton, 0
setGadgetVisible LaunchCheck, 0
endif
if stage = 7
REM Installing
setGadgetVisible NextButton, 0
setGadgetVisible CancelButton, 1
setGadgetVisible BackButton, 0
setGadgetVisible LicenseBox, 0
setGadgetVisible agree, 0
setGadgetVisible dnagree, 0
setGadgetVisible BrowseButton, 0
setGadgetVisible BrowseBox, 0
setGadgetVisible ShortCheck, 0
setGadgetVisible InstallButton, 0
setGadgetVisible InstallBox, 0
setGadgetVisible FinishButton, 0
setGadgetVisible LaunchCheck, 0
l1$ = "Installing"
l2$ = "Please wait while Setup installs " + exe$ + "..."
l3$ = "Extracting files to..."
l4$ = Dest$ + "..."
d3d_starttext
d3d_text 3, 10, 10, 0, l1$, RGB(0,0,0)
d3d_text 2, 10, 25, 0, l2$, RGB(0,0,0)
d3d_text 2, 30, 70, 0, l3$, RGB(0,0,0)
d3d_text 2, 30, 85, 0, l4$, RGB(0,0,0)
d3d_endtext
make directory Dest$
gosub copy_data
exeLoc$=Dest$ + exe$ + ".exe"
IconLoc$=Dest$ + exe$ + ".exe, 0"
Decr$ = exe$ + ", a Dark Basic Professional Game."
if getChecked(ShortCheck) then Add_Shortcut_Desktop(exe$, exeLoc$, IconLoc$, Decr$, "", "")
stage = 8
endif
if stage = 8
REM Finished!
BG=1
l1$ = "Completing " + exe$
l2$ = "Setup Wizard"
l3$ = "Setup has finished installing " + exe$
l4$ = "on your computer. The application may be launched"
l5$ = "by selecting any installed icons."
l6$ = "Click Finish to exit Setup."
d3d_starttext
d3d_text 1, 160, 10, 0, l1$, RGB(0,0,0)
d3d_text 1, 160, 35, 0, l2$, RGB(0,0,0)
d3d_text 2, 160, 80, 0, l3$, RGB(0,0,0)
d3d_text 2, 160, 100, 0, l4$, RGB(0,0,0)
d3d_text 2, 160, 120, 0, l5$, RGB(0,0,0)
d3d_text 2, 160, 160, 0, l6$, RGB(0,0,0)
d3d_endtext
setGadgetVisible NextButton, 0
setGadgetVisible CancelButton, 0
setGadgetVisible BackButton, 0
setGadgetVisible LicenseBox, 0
setGadgetVisible agree, 0
setGadgetVisible dnagree, 0
setGadgetVisible BrowseButton, 0
setGadgetEnabled NextButton, 0
setGadgetVisible BrowseBox, 0
setGadgetVisible ShortCheck, 0
setGadgetVisible InstallButton, 0
setGadgetVisible FinishButton, 1
setGadgetVisible LaunchCheck, 1
endif
sync
loop
`--------------------------------------------- MAIN LOOP END
copy_data:
REM now loop through all files (and folders) in the current folder
type fold
Name as string
NewName as string
endtype
dim Folder(1000) as fold
find first
n=0
file$ = get file name$()
ftype = get file type()
newfile$ = Dest$ + file$
if file$<>"Setup.exe" and ftype<>-1 and ftype=0
copy file file$, newfile$
endif
if ftype<>-1 and ftype=1 and file$<>"." and file$<>".."
make directory newfile$
inc n
Folder(n).Name=file$
Folder(n).NewName=newfile$
endif
REM copy files
repeat
find next
file$ = get file name$()
ftype = get file type()
newfile$ = Dest$ + file$
if file$<>"Setup.exe" and ftype<>-1 and ftype=0
copy file file$, newfile$
endif
if ftype<>-1 and ftype=1 and file$<>"." and file$<>".."
make directory newfile$
inc n
Folder(n).Name=file$
Folder(n).NewName=newfile$
endif
until ftype = -1
REM now look through sub folders
set cursor 0,100
for x=1 to n
folder$=Folder(x).Name
ink rgb(0,0,0),0
set dir folder$
find first
file$ = get file name$()
ftype = get file type()
newfile$ = Folder(x).NewName + "\" + file$
if file$<>"Setup.exe" and ftype<>-1 and ftype=0
copy file file$, newfile$
endif
REM copy files
repeat
find next
file$ = get file name$()
ftype = get file type()
newfile$ = Folder(x).NewName + "\" + file$
if file$<>"Setup.exe" and ftype<>-1 and ftype=0
copy file file$, newfile$
endif
until ftype = -1
next
return
_License:
path$=GET DIR$()
Lfile$=path$+"\License.txt"
if file exist (Lfile$)=0
errorMessage "License file does not exist, Installer Setup Failed!"
end
else
open to read 1, Lfile$
l=1
while line$<>"*"
read string 1, line$
License$ = License$ + line$
if l=2 then exe$ = line$
inc l
endwhile
close file 1
if exe$ = ""
errorMessage "Error finding exe name, Installer Setup Failed!"
end
endif
`trim spaces
exelen = len(exe$)
x=exelen
while x>0
letter$=mid$(exe$,x)
if letter$<>" " and letter$<>" " then e=x : x=0
dec x
endwhile
exe$=mid$(exe$,1,e)
endif
return
`VERY VERY Important - for Blue GUI
function neverCalled()
delete memblock 0
endfunction
function getpath(nFolder)
p$=""
max_path=512
if dll exist(getpath_dll)=0
load dll "shell32.dll",getpath_dll
endif
make memblock getpath_memblock_a,max_path
pszPath = get memblock ptr(getpath_memblock_a)
make memblock getpath_memblock_b,16
ppidl = get memblock ptr(getpath_memblock_b)
HRESULT = call dll(getpath_dll,"SHGetFolderLocation","",nFolder,"",0,ppidl)
if HRESULT = 0
Result = call dll(getpath_dll,"SHGetPathFromIDList", *ppidl,pszPath)
if Result = 1
for b=1 to max_path
m=memblock byte(getpath_memblock_a,b-1)
if m=0 then exit
p$=p$+chr$(m)
next b
endif
endif
delete memblock getpath_memblock_a
delete memblock getpath_memblock_b
endfunction p$
Function Add_Shortcut_Desktop( Name$ as string , FileLocation$ as string , IconLocation$ as string , FileDescription$ as string , WorkingDIR$ as string, ShortcutKeys$ as string )
quote as string : quote = chr$( 34 )
If File Exist("C:\Shortcut.vbs") then Delete File "C:\Shortcut.vbs"
Open To Write 1, "C:\Shortcut.vbs"
Write String 1, "set WshShell = WScript.CreateObject(" + quote + "WScript.Shell" + quote + ")"
Write String 1, "strDesktop = WshShell.SpecialFolders(" + quote + "Desktop" + quote + ")"
Write String 1, "set oShellLink = WshShell.CreateShortcut(strDesktop & " + quote + "\" + Name$ + ".lnk" + quote + ")"
Write String 1, "oShellLink.TargetPath = " + quote + FileLocation$ + quote
Write String 1, "oShellLink.WindowStyle = 1"
Write String 1, "oShellLink.Hotkey = " + quote + ShortcutKeys$ + quote
Write String 1, "oShellLink.IconLocation = " + quote + IconLocation$ + quote
Write String 1, "oShellLink.Description = " + quote + FileDescription$ + quote
Write String 1, "oShellLink.WorkingDirectory = " + quote + WorkingDIR$ + quote
Write String 1, "oShellLink.Save"
Close File 1
Execute File "C:\Shortcut.vbs", "", ""
wait 1000
If File Exist("C:\Shortcut.vbs") then Delete File "C:\Shortcut.vbs"
endFunction
You also need to include the Blue GUI constants file...