Hi Peeps,
I've used AutoIT for quite a while, mainly just for automating the installation of applications that have many steps.
I'm trying to write a very simple GUI that has checkboxes displayed which when ticked and a button is then pressed the relevant apps which the checkboxes relate to would install - simple i thought. All the apps i need to install are part of a single AutoIT script as funtions() with just an if statement for each app checking if it's already installed, so i just need to call the each of the apps func() to install it.
I've attached what i have so far (please don't laugh), i think you should be able to work out what i'm trying to do. It kind of works at the moment but it will only install one application because if more than one checkbox is ticked it ignores the others because of the way i have the if statements - which leads me back to thinking i'm going about this in completly the wrong way. I don't want anyone to e-write anything but if someone could mention what would be a better way and point me in the right direction that would be great.
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("Form1", 185, 185, 192, 124)
$Button1 = GUICtrlCreateButton("Install", 8, 160, 107, 25, $WS_GROUP)
$Checkbox1 = GUICtrlCreateCheckbox("Install App#1", 8, 20, 97, 17)
$Checkbox2 = GUICtrlCreateCheckBox("Install App#2", 8, 40, 97, 17)
$Checkbox3 = GUICtrlCreateCheckBox("Install App#3", 8, 60, 97, 17)
$Checkbox4 = GUICtrlCreateCheckBox("Install App#4", 8, 80, 97, 17)
$Checkbox5 = GUICtrlCreateCheckBox("Install App#5", 8, 100, 97, 17)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE ;You clicked the X
Exit
Case $Button1
If GUICtrlRead($Checkbox1) $GUI_CHECKED Then
MsgBox(4096, "Install", "App1") ;replace with app1 installation func()
ElseIf GUICtrlRead($Checkbox2) = $GUI_CHECKED Then
MsgBox(4096, "Install", "App2")
ElseIf GUICtrlRead($Checkbox3) = $GUI_CHECKED Then
MsgBox(4096, "Install", "App3")
ElseIf GUICtrlRead($Checkbox4) = $GUI_CHECKED Then
MsgBox(4096, "Install", "App4")
ElseIf GUICtrlRead($Checkbox5) = $GUI_CHECKED Then
MsgBox(4096, "Install", "App5")
EndIf
EndSwitch
WEnd
Thanks