MaxWilko Posted May 12, 2021 Share Posted May 12, 2021 Hi all, I've been trying to research about this one but keep hitting a wall so here I am. My goal: To start executing mouse clicks when a word in a box changes to "Done" Would I need a combination of WinExists and If statements? Would this be the best way to do this? If so I would really appreciate a little help with the syntax. Thanks for your time pros! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 12, 2021 Moderators Share Posted May 12, 2021 Moved to the appropriate forum. Moderation Team "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 12, 2021 Moderators Share Posted May 12, 2021 @MaxWilko welcome to the forum. Please post the code you have tried already, even if it is not doing what you want it to do. We will then be happy to assist. MaxWilko 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
water Posted May 12, 2021 Share Posted May 12, 2021 Welcome to Autoit and the forum! Did you try the AutoIt Window Info tool? If it returns the ID for the control you can query the value. MaxWilko 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
MaxWilko Posted May 13, 2021 Author Share Posted May 13, 2021 Hi all ! Hi @water yes! I can use the AutoIT window info tool to find the ID of the control. This is great I can query it's value, I must sound very noob but how would I query the value? attached is a photo of the window info tool & my code Quote ; CTECalibration2 AutoScript for AXF09T390 If @OSArch = "x64" Then DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turns On 64 Bit Redirection ShellExecute("osk.exe") ;turns on on screen keyboard $cartID = InputBox("Cartridge ID", "Please Enter;") ;here a GUI asks for the Cart ID & stores as varible ProcessClose ( "osk.exe" ) DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 0) ;~ Turns Off 64 Bit Redirection EndIf ShellExecute('C:\WINDOWS\CTX Calibration2\CTXCalibration2.exe') WinWait('CTX Cartridge Calibration 2') ;wait for the program to be fully loaded WinActivate('CTX Cartridge Calibration 2') ;this makes the window active for clicking AutoItSetOption('MouseCoordMode', 0) ;need this to click properly MouseClick('primary', 1053, 13, 1, 0) MouseClick('primary', 171, 99, 1, 0) Send("{BACKSPACE}") Send("{BACKSPACE}") Send("{BACKSPACE}") Send("{BACKSPACE}") Send($cartID) MouseClick('primary', 229, 134, 1, 0) Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{DOWN}") Send("{ENTER}") ;select AXF09T390 MouseClick('primary', 449, 45, 1, 0) ;Start Calibration Send("25.007") ;EnterSylvacPreset Send("{ENTER}") BlockInput(1) Sleep (280000) ;Blocks input for duration while calibration is in process ; Now I need to initiate more clicks after message "Done" is displayed, hmmmm Link to comment Share on other sites More sharing options...
MaxWilko Posted May 13, 2021 Author Share Posted May 13, 2021 Just now, MaxWilko said: Hi all ! Hi @water yes! I can use the AutoIT window info tool to find the ID of the control. This is great I can query it's value, I must sound very noob but how would I query the value? attached is a photo of the window info tool & my code Thanks again for your support! Link to comment Share on other sites More sharing options...
Confuzzled Posted May 13, 2021 Share Posted May 13, 2021 I'm assuming it is a text box that updates when the process is done. Put in a loop to test for value = "Done" and continue once the value is true. For extra points, put a counter and a small delay, and exit the loop once the counter has decremented to zero, as the calibration process may hang or time out and your utility will wait forever. Link to comment Share on other sites More sharing options...
JockoDundee Posted May 13, 2021 Share Posted May 13, 2021 @Confuzzled, MaxWilko is asking: 10 hours ago, MaxWilko said: how would I query the value? but your answer of 4 hours ago, Confuzzled said: Put in a loop to test for value = "Done" and continue once the value is true. is both condescending and non-helpful. For extra points, why not explain how to access the value of the control? MaxWilko 1 Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
water Posted May 13, 2021 Share Posted May 13, 2021 (edited) Global $sWindowTitle = "CTX Cartridge Calibration 2" ; Title of the window to wait for Global $iControlID = 67626 ; ID of the control to retrieve the value from Global $sTargetValue = "Done" ; Value to wait for Global $iWaitTime = 5000 ; Time in milliseconds to wait before checking the control again Global $iMaxCheck = 5 ; Maximum retries While 1 $sValue = ControlGetText($sWindowTitle, "", $iControlID) If @error Or $iMaxCheck <= 0 Then Exit MsgBox(0, "Error", "Could not find window or Control") If $sValue = $sTargetValue Then ExitLoop $iMaxCheck = $iMaxCheck - 1 Sleep($iWaitTime) Wend I'm not sure this works at all because IIRC WindowsForms are hard to automate. Edited May 13, 2021 by water Added max retries value MaxWilko 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
MaxWilko Posted May 17, 2021 Author Share Posted May 17, 2021 Thanks @water this was really helpful and I understood it. Problem that occurs it seems is the ControlID changes everytime the program opens, so it cannot find the window and pops the error that was kindly coded for me. I am going to attempt using pixel capture I think its called, there is also a colour that changes when it is complete, perhaps this might be an easier way to script, I will post back with my progress soon. Thanks everyone Link to comment Share on other sites More sharing options...
JockoDundee Posted May 17, 2021 Share Posted May 17, 2021 (edited) 17 minutes ago, MaxWilko said: Problem that occurs it seems is the ControlID changes everytime the program opens $iControlId = ControlGetHandle($sWindowTitle, "", "[NAME:actionBox]") Edited May 17, 2021 by JockoDundee MaxWilko 1 Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
MaxWilko Posted May 18, 2021 Author Share Posted May 18, 2021 21 hours ago, JockoDundee said: $iControlId = ControlGetHandle($sWindowTitle, "", "[NAME:actionBox]") This worked great I used it inside the loop and it is running perfectly thank you @water & @JockoDundee. I next need to export some reports from the software and stick them in a email and send them. But this might be for another forum topic. Link to comment Share on other sites More sharing options...
water Posted May 18, 2021 Share Posted May 18, 2021 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - 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