Jump to content

Install Apps from Checkbox


Recommended Posts

I am new to AutoIT, I am trying to install network apps. Here are two GUI front ends... I would like to install the apps by clicking the check box and clicking the install button. Can someone help me please... I have 7 apps to install in differant locations on the network and I have 30 machines to do. can someone give me an example?

#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

Where do I link the install path to the checkbox and install button.

#include <GUIConstantsEx.au3>

Global $Form1, $Button1, $aCheckbox[5], $nMsg

$Form1 = GUICreate("Form1", 185, 185, 192, 124)
$Button1 = GUICtrlCreateButton("Install", 8, 160, 107, 25)
For $i = 0 To UBound($aCheckbox) - 1
    $aCheckbox[$i] = GUICtrlCreateCheckbox("Bentley Install#" & $i + 1, 8, ($i * 20) + 20, 97, 17)
Next
GUISetState(@SW_SHOW, $Form1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE 
            Exit
        Case $Button1
            For $i = 0 To UBound($aCheckbox) - 1
                If BitAND(GUICtrlRead($aCheckbox[$i]), $GUI_CHECKED) Then MsgBox(4096, "Install", "Done" & $i + 1)
            Next
    EndSwitch
WEnd
Edited by WesW
Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $Checkbox[7]
$Form1 = GUICreate("Form1", 185, 185, 192, 124)
$Button1 = GUICtrlCreateButton("Install", 8, 160, 107, 25, $WS_GROUP)
For $x = 0 to 6
    $Checkbox[$x] = GUICtrlCreateCheckbox("Install App#" & $x+1, 8, $x * 20, 97, 17)
Next
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE ;You clicked the X
            Exit
        Case $Button1
            For $x = 0 to 6
                If GUICtrlRead($Checkbox[$x]) = $GUI_CHECKED Then _Install($x)
            Next
    EndSwitch
WEnd

Func _Install($Program)
    If $Program = 0 Then
        MsgBox(4096, "Install", "App1")
    ElseIf $Program = 1 Then
        MsgBox(4096, "Install", "App2")
    ElseIf $Program = 2 Then
        MsgBox(4096, "Install", "App3")
    ElseIf $Program = 3 Then
        MsgBox(4096, "Install", "App4")
    ElseIf $Program = 4 Then
        MsgBox(4096, "Install", "App5")
    ElseIf $Program = 5 Then
        MsgBox(4096, "Install", "App6")
    ElseIf $Program = 6 Then
        MsgBox(4096, "Install", "App7")
    EndIf
EndFunc

Link to comment
Share on other sites

I am new to AutoIT, I am trying to install network apps. Here are two GUI front ends...

I would like to install the apps by clicking the check box and clicking the install button.

Can someone help me please... I have 7 apps to install in differant locations on the network and I have 30 machines to do. can someone give me an example?

Where do I link the install path to the checkbox and install button.

Try this :

#include <GUIConstantsEx.au3>

Global $Form1, $Button1, $aCheckbox[5], $nMsg, $_BentleyInstallPath[6]

$Form1 = GUICreate("Form1", 185, 185, 192, 124)
$Button1 = GUICtrlCreateButton("Install", 8, 160, 107, 25)
For $i = 0 To UBound($aCheckbox) - 1
    $aCheckbox[$i] = GUICtrlCreateCheckbox("Bentley Install#" & $i + 1, 8, ($i * 20) + 20, 97, 17)
    $_BentleyInstallPath[$i] = @TempDir & '\setup' & $i + 1 & '.exe'
Next
GUISetState(@SW_SHOW, $Form1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            For $i = 0 To UBound($aCheckbox) - 1
                If BitAND(GUICtrlRead($aCheckbox[$i]), $GUI_CHECKED) Then MsgBox(4096, "Install  path", $_BentleyInstallPath[$i] )
            Next
    EndSwitch
WEnd

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>

Global $Form1, $Button1, $aCheckbox[5], $nMsg, $_BentleyInstallPath[6]

$Form1 = GUICreate("Form1", 185, 185, 192, 124)
$Button1 = GUICtrlCreateButton("Install", 8, 160, 107, 25)
For $i = 0 To UBound($aCheckbox) - 1
    $aCheckbox[$i] = GUICtrlCreateCheckbox("Bentley Install#" & $i + 1, 8, ($i * 20) + 20, 97, 17)
    $_BentleyInstallPath[$i] = @TempDir & '\setup' & $i + 1 & '.exe'
Next
GUISetState(@SW_SHOW, $Form1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            For $i = 0 To UBound($aCheckbox) - 1
                If BitAND(GUICtrlRead($aCheckbox[$i]), $GUI_CHECKED) Then MsgBox(4096, "Install  path", $_BentleyInstallPath[$i] )
            Next
    EndSwitch
WEnd

I Have tried the network path here $_BentleyInstallPath[$i] = @TempDir & '\setup' & $i + 1 & '.exe' and Then MsgBox(4096, "Install path", $_BentleyInstallPath[$i] )

it's not working.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...