invis2 Posted July 7, 2016 Share Posted July 7, 2016 (edited) Hi Guys After searching this site and some experimenting, i have come up with code that does what i want, ie closing the are you sure msg box in the form of yes and no after expressing the desire to close my program, its really annoying as i do this 20-30 times a day. WinWait("[CLASS:#32770]", "&Yes") ControlClick("[CLASS:#32770]", "&Yes", "Button1") however as it stands i can only use it once before script disappears from my task bar and i have to run the script again from autoit editor. Could someone help me keep the script alive and give me some hints on how i could perhaps use a hotkey press to activate and deactivate the script. perhaps control ca for on and esc for off. As i say the code itself works flawlessly its stopping starting and maintaining readiness i am struggling with. Any and all help really appreciated. Edited July 7, 2016 by invis2 Link to comment Share on other sites More sharing options...
algiuxas Posted July 7, 2016 Share Posted July 7, 2016 (edited) Could you show all the script that you written? What are you trying to accomplish exactly? Edited July 7, 2016 by algiuxas After switching years ago to Linux, sadly I don't use AutoIt anymore. Link to comment Share on other sites More sharing options...
SadBunny Posted July 7, 2016 Share Posted July 7, 2016 31 minutes ago, invis2 said: WinWait("[CLASS:#32770]", "&Yes") ControlClick("[CLASS:#32770]", "&Yes", "Button1") If that is your entire script, it will execute, then wait until that WinWait is true (it becomes true as soon as that window exists), then continues to the ControlClick. As there is no further script after that, the script stops at that point. What you need is a loop so that this procedure is repeated forever. Try putting your code in a loop: While 1 WinWait("[CLASS:#32770]", "&Yes") ControlClick("[CLASS:#32770]", "&Yes", "Button1") sleep(50) ; avoid high cpu usage WEnd Just like your script, it will execute, wait for that window, click that control once the window appears, but instead of exiting, the WEnd will make the script go back to the While as long as the expression that the While evaluates is true. (And "1" is a true expression so this will repeat forever.) Check the helpfile for "Language Reference - Loop Statements". Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
invis2 Posted July 7, 2016 Author Share Posted July 7, 2016 Thank you so much exactly what i was looking for, thanks for your help Link to comment Share on other sites More sharing options...
SadBunny Posted July 7, 2016 Share Posted July 7, 2016 Roses are FF0000, violets are 0000FF... All my base are belong to you. 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