Sign in to follow this  
Followers 0
invis2

Script execution

5 posts in this topic

#1 ·  Posted (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 by invis2

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Could you show all the script that you written?
 

What are you trying to accomplish exactly?

Edited by algiuxas

42783.png

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Thank you so much exactly what i was looking for, thanks for your help

 

Share this post


Link to post
Share on other sites

:thumbsup:


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0