trof Posted August 8, 2016 Posted August 8, 2016 (edited) Hi, I'd like to repeatedly click on a button that is enabled/disabled many times per minute For the button that is alternately enabled/disabled, I use WinActivate("Stato motore Script") Do Sleep(150) Until ControlCommand("Stato motore Script", '', "[NAME:CmdContinue]]", "IsEnabled") = 1 ControlClick("Stato motore Script", "", "[NAME:CmdContinue]]") For the loop, I'd like to use While 1 WinActivate("Stato motore Script") ControlClick("Stato motore Script", "", "[NAME:CmdContinue]") WEnd exit I tried to merge both scripts, Do Sleep(150) While 1 WinActivate("Stato motore Script") Until ControlCommand("Stato motore Script", '', "[NAME:CmdContinue]]", "IsEnabled") = 1 ControlClick("Stato motore Script", "", "[NAME:CmdContinue]]") WEnd Exit but it doesn't work Edited August 8, 2016 by trof
ViciousXUSMC Posted August 8, 2016 Posted August 8, 2016 Do While WEnd Until The way you have it now the loops wont interact as your while loop will not reference Do/Until when it loops. What you should probably do is create just one loop and add some If/Then statements. Maybe something like this? While 1 If WinExists("Stato motore Script") Then WinActivate("Stato motore Script") If ControlCommand("Stato motore Script", '', "[NAME:CmdContinue]]", "IsEnabled") = 1 Then ControlClick("Stato motore Script", "", "[NAME:CmdContinue]") EndIf EndIf Sleep(10) WEnd
trof Posted August 8, 2016 Author Posted August 8, 2016 Thanks, I solved with a simple loop as you suggested me. I didn't well observe the popup windows. I don't need If ControlCommand("Stato motore Script", '', "[NAME:CmdContinue]]", "IsEnabled") = 1 Then My loop is WinActivate("Stato motore Script") While 1 WinWaitActive("Stato motore Script", "Ignora e Continua") ControlClick("Stato motore Script", "", "[NAME:CmdContinue]") WEnd exit I apologize for my hastiness
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