Jump to content
Gberrocal

Help with special radio and button boolean

Recommended Posts

Hello I need help, I am not too familiar with AutoIT. What I need to do is when a specific radio button is selected like for example (Laptop) then specific laptop scripts will. In one group I have check boxes set to install programs but there is a different way if it is a laptop vs a desktop so I need the right one to trigger but I am having trouble figuring out a way to best do this. Below is an example of the GUI so you can better understand. 

 

#RequireAdmin

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\user\desktop\test\gui forms\form1.kxf
Global $Form1_1 = GUICreate("APM Script", 436, 463, -1, -1)
Global $Label1 = GUICtrlCreateLabel("New Computer Script", 208, 16, 161, 17)
Global $Label6 = GUICtrlCreateLabel("Outlook User Info", 272, 48, 87, 17)
Global $Input1 = GUICtrlCreateInput("Password", 264, 72, 121, 21)
Global $Label7 = GUICtrlCreateLabel("Office 365 User Acount Info", 256, 128, 136, 17)
Global $Input2 = GUICtrlCreateInput("Email Address", 264, 160, 121, 21)
Global $Input3 = GUICtrlCreateInput("Password", 266, 194, 121, 21)
Global $Button1 = GUICtrlCreateButton("Start Script!", 288, 232, 75, 25)
;~ $Group1 = GUICtrlCreateGroup("", 32, 128, 121, 97)
Global $Label8 = GUICtrlCreateLabel("Remote Desktop", 48, 144, 84, 17)
Global $Radio5 = GUICtrlCreateRadio("New Server", 48, 168, 113, 17)
Global $Radio6 = GUICtrlCreateRadio("Old Server", 48, 200, 113, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
;~ $Group2 = GUICtrlCreateGroup("", 40, 24, 105, 97)
Global $Label3 = GUICtrlCreateLabel("Computer Type?", 47, 42, 82, 17)
Global $Radio3 = GUICtrlCreateRadio("Laptop", 47, 66, 113, 17)
Global $Radio4 = GUICtrlCreateRadio("Desktop", 47, 90, 113, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
;~ $Group3 = GUICtrlCreateGroup("", 40, 232, 113, 105)
Global $Label2 = GUICtrlCreateLabel("Desktop Icons", 57, 245, 73, 17)
Global $Checkbox6 = GUICtrlCreateCheckbox("Condo Certs", 49, 269, 97, 17)
Global $Checkbox7 = GUICtrlCreateCheckbox("Avid X Change", 49, 293, 97, 17)
Global $Checkbox8 = GUICtrlCreateCheckbox("Tops One", 49, 317, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
;~ $Group4 = GUICtrlCreateGroup("", 40, 352, 105, 105)
Global $Label9 = GUICtrlCreateLabel("Applications", 57, 365, 61, 17)
Global $Checkbox3 = GUICtrlCreateCheckbox("Paper Cut", 49, 381, 97, 17)
Global $Checkbox9 = GUICtrlCreateCheckbox("NetExtender", 49, 405, 97, 17)
Global $Checkbox4 = GUICtrlCreateCheckbox("Caliber", 48, 432, 97, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

         Case $Button1
            If GUICtrlRead($Radio3) = 1 Then
               MsgBox(0,1,"Laptop Install!")
               ;Agent_Install()
               ;Teams_Install()
               ;Chrome_Install()
               ;Adobe_Install()
               ;DefaultApps_Laptop()
            ElseIf GUICtrlRead($Radio4) = 1 Then
               MsgBox(0,1,"Desktop Install!")
               ;Agent_Install()
               ;Teams_Install()
               ;Chrome_Install()
               ;Adobe_Install()
               ;DefaultApps_Desktop()
            EndIf
            If GUICtrlRead($Checkbox3) = 1 Then
               MsgBox(0,1,"Paper Cut Laptop Install!")
            EndIf

            If GUICtrlRead($Checkbox9) = 1 Then
               MsgBox(0,2,"Netextender Install!")
            EndIf
            If GUICtrlRead($Checkbox4) = 1 Then
               MsgBox(0,3,"Caliber Install!")
            EndIf

    EndSwitch
WEnd

Func Agent_Install()
;Agent Install
Run("\\computer\Applications\Agent_Install.MSI")
AutoItSetOption("MouseCoordMode", 0)

WinWait("ConnectWise Automate Remote Agent Setup")
WinActivate("ConnectWise Automate Remote Agent Setup")
Sleep(300)
Send("{Enter}")
Sleep(300)
Send("{Enter}")
Sleep(300)
Send("{Enter}")
WinWait("ConnectWise Automate Remote Agent Setup", "Click the Finish button to exit the Setup Wizard.")
Sleep(300)
Send("{Enter}")
EndFunc

Func Teams_Install()
;Teams Install
RunWait("\\computer\Applications\Teams_windows_x64.exe /s")
EndFunc

Func Chrome_Install()
;Chrome Install
RunWait("\\computer\Applications\chromesetup.exe /silent /install")
EndFunc

Func Adobe_Install()
;Adobe Acrobat Reader DC
RunWait("\\computer\Applications\AcrobatReader\setup.exe")
EndFunc

Func Netextender_Install_Laptop()
;Netextender Install
ShellExecute("\\computer\Applications\Netextender.msi")
AutoItSetOption("MouseCoordMode", 0)

WinWait("SonicWall NetExtender")
WinActivate("SonicWall NetExtender")
MouseClick("primary", 465, 397 ,1 ,0)
Sleep(300)
MouseClick('primary', 226, 353, 1, 0)
MouseClick('primary', 442, 398, 1, 0)
Sleep(300)
MouseClick('primary', 442, 398, 1 , 0)
Sleep(100)
ControlFocus("SonicWall NetExtender", "",  "RichEdit20W1")
ControlSend("SonicWall NetExtender", "", "RichEdit20W1", "website.com")
ControlFocus("SonicWall NetExtender", "",  "RichEdit20W2")
ControlSend("SonicWall NetExtender", "", "RichEdit20W2", "website.com")
MouseClick('primary', 36, 258, 1 , 0)
MouseClick('primary', 452, 396, 1 , 0)
Sleep(100)
MouseClick('primary', 427, 396, 1, 0)
Sleep(20000)
WinClose("SonicWall NetExtender")
EndFunc

Func Caliber_Install()
;Caliber Install
RunWait("\\computer\Applications\Caliber.exe /S /v/qn")
EndFunc

Func PaperCut_Install_Laptop()
;PaperCut Install
Run("\\computer\client-local-install.exe /NORESTART")
AutoItSetOption("MouseCoordMode", 0)

WinWait("Setup - PaperCut MF Client")
WinActivate("Setup - PaperCut MF Client")
MouseClick("primary", 49, 292, 1, 0)
Sleep(300)
Send("{Enter}")
Sleep(300)
Send("{Enter}")
Sleep(300)
Send("{Enter}")
Sleep(300)
Send("{Enter}")
WinWait("Setup - PaperCut MF Client", "Completing the PaperCut MF Client Setup Wizard")
MouseClick("primary", 186, 186, 1, 0)
Sleep(300)
Send("{Enter}")
EndFunc

Func DefaultApps_Laptop()
;Default Apps
ShellExecute("shell:::{17cd9488-1228-4b2f-88ce-4298e93e0966}")
AutoItSetOption("MouseCoordMode", 0)
WinWait("Default Programs")
WinActivate("Default Programs")
MouseClick("primary", 309, 131, 1, 0)
WinClose("Default Programs")
WinWait("Settings")
WinActivate("Settings")
Sleep(2000)
MouseWheel("down", 5)
MouseClick("left",480,214,1)
MouseUp("left")
MouseClick("left",493,349,1)
MouseUp("left")
Sleep(200)
MouseClick("left",493,377,1)
MouseUp("left")
Sleep(20000)
MouseWheel("down", 320)
Sleep(200)
MouseClick("left",395,247,1)
MouseUp("left")
Sleep(200)
MouseClick("left",502,376,1)
Sleep(200)
MouseUp("left")
MouseClick("primary",26,16,1)
Sleep(13000)
MouseClick("left",476,214,1)
MouseUp("left")
MouseClick("left",484,456,1)
MouseUp("left")
EndFunc

Func PaperCut_Install_Desktop()
;PaperCut Install
Run("\\computer\client-local-install.exe /NORESTART")
AutoItSetOption("MouseCoordMode", 0)

WinWait("Setup - PaperCut MF Client")
WinActivate("Setup - PaperCut MF Client")
MouseClick("primary", 51, 302, 1, 0)
Sleep(300)
Send("{Enter}")
Sleep(300)
Send("{Enter}")
Sleep(300)
Send("{Enter}")
Sleep(300)
Send("{Enter}")
WinWait("Setup - PaperCut MF Client", "Completing the PaperCut MF Client Setup Wizard")
MouseClick("primary", 189, 185, 1, 0)
Sleep(300)
Send("{Enter}")
EndFunc

Func DefaultApps_Desktop()
;Default Apps
ShellExecute("shell:::{17cd9488-1228-4b2f-88ce-4298e93e0966}")
AutoItSetOption("MouseCoordMode", 0)
WinWait("Default Programs")
WinActivate("Default Programs")
MouseClick("primary", 326, 128, 1, 0)
Sleep(300)
WinClose("Default Programs")
WinWait("Settings")
WinActivate("Settings")
Sleep(1000)
MouseClick("left",466,792,1)
MouseUp("left")
MouseClick("left",608,574,1)
MouseUp("left")
MouseWheel("down", 4)
Sleep(500)
MouseClick("left",512,766,1)
MouseUp("left")
Sleep(10000)
MouseWheel("down", 202)
Sleep(2000)
MouseClick("left",436,784,1)
MouseUp("left")
MouseClick("left",555,587,1)
MouseUp("left")
MouseClick("left",30,16,1)
Sleep(7000)
MouseClick("left",450,216,1)
MouseUp("left")
MouseClick("left",547,468,1)
MouseUp("left")
WinClose("Settings")
EndFunc

 

image.png.b27906e2f330eb1ef581361eec4ef486.png

Share this post


Link to post
Share on other sites

Thank you! That sent me in the right direction, using that and some other forum posts I was able to make it work!

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...