motherbrainz Posted September 14, 2013 Share Posted September 14, 2013 I am using the following command to trigger overwriting a value in the registry right after the OK button appears. It works great as long as the "OK" button appears. However, in some cases the "OK" button never appears because the machine does not meet a certain criteria. My goal is to wrap this command around a timeout so that if the button never appears It wont get stuck waiting for the button indefinitely. Maybe my approach is wrong but I can't seem to use WinWaitActive because all the window titles are the same so my command does not get triggered at the correct moment. Thanks in advance to all. ;Wait & Import Registry Then Click Ok While 1 $var = ControlGetText("[CLASS:#32770]", "", "Button1") Sleep(1000) If $var = "OK" Then Run("ImportReg.bat") Sleep(1000) Send("{SPACE}") ExitLoop EndIf WEnd Link to comment Share on other sites More sharing options...
Solution JohnOne Posted September 14, 2013 Solution Share Posted September 14, 2013 $SecondsToWait = 2 $Timer = TimerInit() While TimerDiff($Timer) < ($SecondsToWait * 1000) $var = ControlGetText("[CLASS:#32770]", "", "Button1") Sleep(1000) If $var = "OK" Then Run("ImportReg.bat") Sleep(1000) Send("{SPACE}") ExitLoop EndIf WEnd mmfalcao 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
motherbrainz Posted September 14, 2013 Author Share Posted September 14, 2013 Thanks John, That works perfectly for what I am trying to do! I really appreciate it!!! 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