weevil Posted December 15, 2016 Share Posted December 15, 2016 Hi All, I am new to the world of GUI AutoIt, but I know my way around the program. I am trying to automate the logging in of a piece of software, and there comes a point during the script where I need to get user input to continue. I've created a rudimentary text box and OK button to facilitate this, but when I do it won't close the GUI gracefully and continue running the script, it just halts and doesn't carry on. expandcollapse popup#include <GUIConstants.au3> global $address = "testaddress" global $port = "1111" global $logonscript = "" global $script = "" run("C:\Program Files (x86)\Crystal Point\OutsideView\outside32.exe") WinWait("OutsideView - Untitled Workspace") sleep(500) WinActivate("OutsideView - Untitled Workspace") Sleep(2000) Send("^n") Login() Sleep(2000) LogonScript() Sleep(2000) Login2() Func Login() Local $handle = WinWait("Session Settings") WinActivate($handle) ToolTip($handle) ControlClick($handle, "", "SysTreeView32") ;focus into left hand menu bar Send("{DOWN 2}") ;navigate to IO sleep(500) ControlGetFocus($handle, "") ;confirm focus ControlSend($handle, "", "ComboBox1", "^a {DEL}") ;remove current address in box. ControlSend($handle, "", "ComboBox1" , $address & " " & $port) ;input address and port into box ControlClick($handle, "", "Button4") ;click "encrypt data stream using SSL" ControlClick($handle, "", "Button5") ;click "invoke service/logon script" ControlClick($handle, "", "Button11") ;untick "Validate certificate CN against domain name" ControlClick($handle, "", "Button5") ;click "invoke service/logon script" Sleep(500) ControlSend($handle, "", "Edit3" , $logonscript) ;input script into box ControlClick($handle, "", "Button12") ;click "advance certificate/encryption options" Sleep(500) Local $handle2 = WinWait("Advanced Certificate/Encryption Options") WinActivate($handle2) ControlGetFocus($handle2, "") ;confirm focus ControlClick($handle2, "", "Button13") ;Click "Choose Specific Cipher Suites" ControlClick($handle2, "", "Button10") ;Click "Select All" ControlClick($handle2, "", "Button8") ;Click OK Local $handle3 = WinWait("Session Settings") WinActivate($handle3) ControlGetFocus($handle3, "") ;confirm focus ControlClick($handle, "", "Button13") ;Click OK endFunc Func LogonScript() ; GUI local $gui = GUICreate("Auto Loader", 200, 150) ; LABEL $Label_1 = GUICtrlCreateLabel("Please Enter Logon Script", 30, 10, 100, 20) ; Input $Input_1 = GUICtrlCreateInput("TACL", 70, 20, 50, 20) ; BUTTON $RUN_1 = GUICtrlCreateButton("OK", 50, 50, 100, 50) ; GUI MESSAGE LOOP GUISetState() While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $RUN_1 $script = GUICtrlRead($Input_1) GUIDelete($gui) EndSelect Tooltip("Stuck in while1") WEnd Tooltip ("stuck in function") EndFunc Func Login2() Local $handle = WinWait("OutsideView - Untitled Workspace* - Tandem*") Sleep (2000) Send($script) Send ("{ENTER}") EndFunc It gets stuck at the end of the While 1 statement (I am using tooltips here to debug) and it doesn't exit the while loop properly. I need whatever is typed into the text box to come back as a variable $script to continue logging in. Any ideas? Thanks! Link to comment Share on other sites More sharing options...
Developers Jos Posted December 15, 2016 Developers Share Posted December 15, 2016 You need to exit the loop when deleting the GUI: While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $RUN_1 $script = GUICtrlRead($Input_1) GUIDelete($gui) ExitLoop EndSelect ToolTip("Stuck in while1") WEnd Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
weevil Posted December 15, 2016 Author Share Posted December 15, 2016 5 minutes ago, Jos said: You need to exit the loop when deleting the GUI: While 1 $MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE Exit Case $MSG = $RUN_1 $script = GUICtrlRead($Input_1) GUIDelete($gui) ExitLoop EndSelect ToolTip("Stuck in while1") WEnd Jos D'Oh! Knew it had to be something stupid. Thank you very much Link to comment Share on other sites More sharing options...
caramen Posted January 2, 2017 Share Posted January 2, 2017 You can now EDIT solved My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now