Microsoft Small Basic

Program Listing: TCQ854
'Installer
'created by Timo Söchtig
' - Quality made in Germany -
CreateButtons()
lang = "En"
SetButtonLanguage()

page = 0
ShowPage()
Controls.ButtonClicked = OnButtonClicked

'===============================================
'BUTTON SUBROUTINES
'===============================================

Sub CreateButtons
numButton = 0
GraphicsWindow.FontName = "Arial"
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.FontSize = 20
GraphicsWindow.FontBold = 0

'Page 0
numButton = numButton+1
buttonData[numButton]["Page"] = 0
buttonData[numButton]["X"] = 42
buttonData[numButton]["Y"] = 20
buttonData[numButton]["En"] = "English"
buttonData[numButton]["De"] = "Englisch"

numButton = numButton+1
buttonData[numButton]["Page"] = 0
buttonData[numButton]["X"] = 40
buttonData[numButton]["Y"] = 70
buttonData[numButton]["En"] = "Deutsch"
buttonData[numButton]["De"] = "Deutsch"


'Page 1
numButton = numButton+1
buttonData[numButton]["Page"] = 1
buttonData[numButton]["X"] = -180
buttonData[numButton]["Y"] = -30
buttonData[numButton]["En"] = "Back"
buttonData[numButton]["De"] = "Zurück"

numButton = numButton+1
buttonData[numButton]["Page"] = 1
buttonData[numButton]["X"] = -80
buttonData[numButton]["Y"] = -30
buttonData[numButton]["En"] = "Next"
buttonData[numButton]["De"] = "Weiter"

numButton = numButton+1
buttonData[numButton]["Page"] = 1
buttonData[numButton]["X"] = -650
buttonData[numButton]["Y"] = -30
buttonData[numButton]["En"] = "Cancel"
buttonData[numButton]["De"] = "Abbrechen"


'Page 2
numButton = numButton+1
buttonData[numButton]["Page"] = 2
buttonData[numButton]["X"] = -190
buttonData[numButton]["Y"] = -30
buttonData[numButton]["En"] = "Back"
buttonData[numButton]["De"] = "Zurück"

numButton = numButton+1
buttonData[numButton]["Page"] = 2
buttonData[numButton]["X"] = -115
buttonData[numButton]["Y"] = -30
buttonData[numButton]["En"] = "Accept"
buttonData[numButton]["De"] = "Akzeptieren"

numButton = numButton+1
buttonData[numButton]["Page"] = 2
buttonData[numButton]["X"] = -650
buttonData[numButton]["Y"] = -30
buttonData[numButton]["En"] = "Cancel"
buttonData[numButton]["De"] = "Abbrechen"


'Page 3
numButton = numButton+1
buttonData[numButton]["Page"] = 3
buttonData[numButton]["X"] = -80
buttonData[numButton]["Y"] = -30
buttonData[numButton]["En"] = "Finish"
buttonData[numButton]["De"] = "Fertig"

numPage = 0
For _i = 1 To numButton
buttons[_i] = Controls.AddButton("",-1000,-1000)
numPage = Math.Max(numPage,buttonData[_i]["Page"])
EndFor
EndSub

Sub HideAllButtons
For _i = 1 To numButton
Controls.HideControl(buttons[_i])
EndFor
EndSub

Sub SetButtonLanguage
For _i = 1 To numButton
Controls.SetButtonCaption(buttons[_i],buttonData[_i][lang])
EndFor
EndSub

Sub ShowPageButtons
HideAllButtons()
For _i = 1 To numButton
If (page = buttonData[_i]["Page"]) Then
x = buttonData[_i]["X"]
y = buttonData[_i]["Y"]
If (x < 0) Then
x = x+gw
EndIf
If (y < 0) Then
y = y+gh
EndIf
Shapes.Move(buttons[_i],x,y)
Controls.ShowControl(buttons[_i])
EndIf
EndFor
EndSub

'===============================================
'PAGE SUBROUTINES
'===============================================

Sub InitialisePage
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
GraphicsWindow.CanResize = "False"
GraphicsWindow.Left = 650
GraphicsWindow.Top = 400
LDUtilities.Icon = Program.Directory + "\Icon.ico" 'The name of the Icon and the directory of it. This is a feature of the LitDev extension.
GraphicsWindow.Title = "Timo Sö's Installer"
GraphicsWindow.FontName = "Arial"
GraphicsWindow.BrushColor = "Black"
GraphicsWindow.FontSize = 20
GraphicsWindow.FontBold = 0
EndSub

Sub ShowPage
If (page = 0) Then
gw = 180
gh = 130
Else
gw = 650
gh = 500
EndIf
InitialisePage()
ShowPageButtons()
ClearPage()
'Do page specific stuff or call appropriate subroutine
If (page = 1) Then
If (lang = "De") Then
Hintergrund = ImageList.LoadImage(Program.Directory + "\Hintergrund Installer.bmp") 'The name of the Menu background and the directory of it.
GraphicsWindow.DrawImage(Hintergrund, 0, 0)
LDUtilities.Icon = Program.Directory + "\Icon.ico" 'The name of the Icon and the directory of it. This is a feature of the LitDev extension.
GraphicsWindow.Title = "Timo Sö's Installer"

GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1
GraphicsWindow.PenWidth = 0
GraphicsWindow.DrawRectangle(25,75,600,420)
GraphicsWindow.DrawBoundText(30,110,600,"Willkommen bei Timo Sö's Installer! Der Programmordner wird automatisch erstellt.") 'Enter your text here.
GraphicsWindow.DrawBoundText(30,160,600,"Bitte gebt den Installationspfad ein:") 'Enter your text here
PfadFenster()
GraphicsWindow.FontSize = 20
GraphicsWindow.FontBold = 0
ElseIf (lang = "En") Then
Hintergrund = ImageList.LoadImage(Program.Directory + "\Hintergrund Installer.bmp")
GraphicsWindow.DrawImage(Hintergrund, 0, 0)
LDUtilities.Icon = Program.Directory + "\Icon.ico"
GraphicsWindow.Title = "Timo Sö's Installer"

GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1
GraphicsWindow.PenWidth = 0
GraphicsWindow.DrawRectangle(25,75,600,420)
GraphicsWindow.DrawBoundText(30,110,600,"Welcome to Timo Sö's installer! The programfolder will automatically create.") 'Enter your text here.
GraphicsWindow.DrawBoundText(30,160,600,"Please enter the installation path:") 'Enter your text here
PfadFenster()
GraphicsWindow.FontSize = 20
GraphicsWindow.FontBold = 0
EndIf
ElseIf (page = 2) Then
Hintergrund2 = ImageList.LoadImage(Program.Directory + "\Hintergrund Installer.bmp")
GraphicsWindow.DrawImage(Hintergrund2, 0, 0)
Controls.HideControl(EinPfadBox)

If (lang = "De") Then
' The following line could be harmful and has been automatically commented.
' Readme = File.ReadContents(Program.Directory + "\README_DE.txt") 'Here will the German README file load
GraphicsWindow.DrawBoundText(30, 110, 600, Readme)
ElseIf (lang = "En") Then
' The following line could be harmful and has been automatically commented.
' Readme = File.ReadContents(Program.Directory + "\README_EN.txt") 'Here will the English README file load
GraphicsWindow.DrawBoundText(30, 110, 600, Readme)
EndIf

ElseIf (page = 3) Then
If (lang = "De") Then

Hintergrund1 = ImageList.LoadImage(Program.Directory + "\Hintergrund Installer.bmp")'The name of the Menu background and the directory of it.
GraphicsWindow.DrawImage(Hintergrund1, 0, 0)
Pfad()
Controls.HideControl(EinPfadBox)
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1
GraphicsWindow.PenWidth = 0
GraphicsWindow.DrawRectangle(30,100,600,420)
GraphicsWindow.DrawBoundText(30,120,600,"DeinProgramm wird nun installiert...")
GraphicsWindow.FontSize = 15
GraphicsWindow.DrawBoundText(30, 170, 550, "Erstelle Verzeichnisse...")
' The following line could be harmful and has been automatically commented.
' W = File.CreateDirectory(Direc[1] + Direc[2])
' The following line could be harmful and has been automatically commented.
' X = File.CreateDirectory(Direc[1] + Direc[2] + Direc[3])
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
GraphicsWindow.DrawBoundText(280, 170, 550, "Fertig!")
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1


GraphicsWindow.DrawBoundText(30, 200, 550, "Kopiere Bilder...")' !Enter all your files at the following parts!
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
' The following line could be harmful and has been automatically commented.
' B1 = File.CopyFile(Program.Directory + "\Data\Bilder\Icon.ico", Direc[1] + Direc[2] + Direc[3])
GraphicsWindow.DrawBoundText(280, 200, 550, "Fertig!")
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1


GraphicsWindow.DrawBoundText(30, 260, 550, "Kopiere DeinProgramm.exe...")
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
' The following line could be harmful and has been automatically commented.
' A = File.CopyFile(Program.Directory + "\Data\DeinProgramm.exe", Direc[1] + Direc[2])
GraphicsWindow.DrawBoundText(280, 260, 550, "Fertig!")
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1


GraphicsWindow.DrawBoundText(30, 290, 550, "Kopiere Data.dll...")
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
' The following line could be harmful and has been automatically commented.
' E = File.CopyFile(Program.Directory + "\Data\Data.dll", Direc[1] + Direc[2])
GraphicsWindow.DrawBoundText(280, 290, 550, "Fertig!")
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1


GraphicsWindow.DrawBoundText(30, 320, 550, "Kopiere FC.dll...")
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
' The following line could be harmful and has been automatically commented.
' D = File.CopyFile(Program.Directory + "\Data\FC.dll", Direc[1] + Direc[2])
GraphicsWindow.DrawBoundText(280, 320, 550, "Fertig!")
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1


GraphicsWindow.DrawBoundText(30, 350, 550, "Kopiere DeinProgramm.pdb...")
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
' The following line could be harmful and has been automatically commented.
' B = File.CopyFile(Program.Directory + "\Data\DeinProgramm.pdb", Direc[1] + Direc[2])
GraphicsWindow.DrawBoundText(280, 350, 550, "Fertig!")
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1


GraphicsWindow.DrawBoundText(30, 380, 550, "Kopiere SmallBasicLibrary.dll...")
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
' The following line could be harmful and has been automatically commented.
' C = File.CopyFile(Program.Directory + "\Data\SmallBasicLibrary.dll", Direc[1] + Direc[2])
GraphicsWindow.DrawBoundText(280, 380, 550, "Fertig!")
GraphicsWindow.FontSize = 20

'DATEI LEEREN
' The following line could be harmful and has been automatically commented.
' File.WriteContents(Program.Directory + "\Pfad.txt", "")

ElseIf (lang = "En") Then

Hintergrund1 = ImageList.LoadImage(Program.Directory + "\Hintergrund Installer.bmp")' ##
GraphicsWindow.DrawImage(Hintergrund1, 0, 0)
Pfad()
Controls.HideControl(EinPfadBox)
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1
GraphicsWindow.PenWidth = 0
GraphicsWindow.DrawRectangle(30,100,600,420)
GraphicsWindow.DrawBoundText(30,120,600,"NoobHelper is installing...")
GraphicsWindow.FontSize = 15
GraphicsWindow.DrawBoundText(30, 170, 550, "Create directories...")
' The following line could be harmful and has been automatically commented.
' W = File.CreateDirectory(Direc[1] + Direc[2])
' The following line could be harmful and has been automatically commented.
' X = File.CreateDirectory(Direc[1] + Direc[2] + Direc[3])
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
GraphicsWindow.DrawBoundText(280, 170, 550, "Done!")
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1


GraphicsWindow.DrawBoundText(30, 200, 550, "Copy Pictures...")
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
' The following line could be harmful and has been automatically commented.
' B1 = File.CopyFile(Program.Directory + "\Data\Bilder\Icon.ico", Direc[1] + Direc[2] + Direc[3])
GraphicsWindow.DrawBoundText(280, 200, 550, "Done!")
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1


GraphicsWindow.DrawBoundText(30, 260, 550, "Copy YourProgram.exe...")
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
' The following line could be harmful and has been automatically commented.
' A = File.CopyFile(Program.Directory + "\Data\YourProgram.exe", Direc[1] + Direc[2])
GraphicsWindow.DrawBoundText(280, 260, 550, "Done!")
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1


GraphicsWindow.DrawBoundText(30, 290, 550, "Copy Data.dll...")
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
' The following line could be harmful and has been automatically commented.
' E = File.CopyFile(Program.Directory + "\Data\Data.dll", Direc[1] + Direc[2])
GraphicsWindow.DrawBoundText(280, 290, 550, "Done!")
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1


GraphicsWindow.DrawBoundText(30, 320, 550, "Copy FC.dll...")
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
' The following line could be harmful and has been automatically commented.
' D = File.CopyFile(Program.Directory + "\Data\FC.dll", Direc[1] + Direc[2])
GraphicsWindow.DrawBoundText(280, 320, 550, "Done!")
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1


GraphicsWindow.DrawBoundText(30, 350, 550, "Copy YourProgram.pdb...")
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
' The following line could be harmful and has been automatically commented.
' B = File.CopyFile(Program.Directory + "\Data\YourProgram.pdb", Direc[1] + Direc[2])
GraphicsWindow.DrawBoundText(280, 350, 550, "Done!")
GraphicsWindow.FontSize = 15
GraphicsWindow.FontBold = 1


GraphicsWindow.DrawBoundText(30, 380, 550, "Copy SmallBasicLibrary.dll...")
GraphicsWindow.FontSize = 18
GraphicsWindow.FontBold = 0
' The following line could be harmful and has been automatically commented.
' C = File.CopyFile(Program.Directory + "\Data\SmallBasicLibrary.dll", Direc[1] + Direc[2])
GraphicsWindow.DrawBoundText(280, 380, 550, "Done!")
GraphicsWindow.FontSize = 20

'DATEI LEEREN
' The following line could be harmful and has been automatically commented.
' File.WriteContents(Program.Directory + "\Pfad.txt", "")

EndIf
EndIf
EndSub

Sub ClearPage
brush = GraphicsWindow.BrushColor
GraphicsWindow.BrushColor = GraphicsWindow.BackgroundColor
GraphicsWindow.FillRectangle(0,0,gw,gh)
GraphicsWindow.BrushColor = brush
EndSub



'===============================================
'README WINDOWS
'===============================================

Sub PfadFenster
EinPfadBox = Controls.AddMultiLineTextBox(30,200) 'That's the box, where the user enter the installation path
Controls.SetSize(EinPfadBox,590,30)
Controls.SetTextBoxText(EinPfadBox, "C:\YourProgram") 'That's an example for the user
EndSub


Sub Pfad
Directory = Controls.GetTextBoxText(EinPfadBox)
' The following line could be harmful and has been automatically commented.
' File.WriteLine(Program.Directory + "\Pfad.txt", 1, Directory) 'Here will the install path save and prepare to use
' The following line could be harmful and has been automatically commented.
' File.WriteLine(Program.Directory + "\Pfad.txt", 2, "\Data")
' The following line could be harmful and has been automatically commented.
' File.WriteLine(Program.Directory + "\Pfad.txt", 3, "\Bilder")
' The following line could be harmful and has been automatically commented.
' Direc[1] = File.ReadLine(Program.Directory + "\Pfad.txt", 1)
' The following line could be harmful and has been automatically commented.
' Direc[2] = File.ReadLine(Program.Directory + "\Pfad.txt", 2)
' The following line could be harmful and has been automatically commented.
' Direc[3] = File.ReadLine(Program.Directory + "\Pfad.txt", 3)
EndSub



'===============================================
'EVENT SUBROUTINES
'===============================================



Sub OnButtonClicked
button = Controls.LastClickedButton 'Here is define, what happen if a button is clicked. You must add one new "If" part for every new button.
For i = 1 To numButton
If (button = buttons[i]) Then
If (buttonData[i]["En"] = "English") Then
lang = "En"
SetButtonLanguage()
page = 1
ShowPage()
ElseIf (buttonData[i]["En"] = "Deutsch") Then
lang = "De"
SetButtonLanguage()
page = 1
ShowPage()
ElseIf (buttonData[i]["En"] = "Back") Then
page = page-1
ShowPage()
ElseIf (buttonData[i]["En"] = "Next" And page < numPage) Then
page = page+1
ShowPage()
ElseIf (buttonData[i]["En"] = "Accept") Then
page = page+1
ShowPage()
ElseIf (buttonData[i]["En"] = "Cancel") Then
Program.End()
ElseIf (buttonData[i]["En"] = "Finish") Then
Program.End()
EndIf
EndIf
EndFor
EndSub