Sign in to follow this  
Followers 0
jonnybignote

Newbie WinWaitAcvtive

6 posts in this topic

Hi all

sorry for rudimentary request but am stuck on simple wait for window, hit return(get out of antivirus advert window)

Current code gives high cpu utilisation

WinWaitActive ("Notifier of Avira AntiVir Personal - Free Antivirus")
Send("^{Return}")

I know I need to put some kind of wait/sleep function as this is intended to run all the time and probably some kind of loop so code keeps on running but I'm getting nowhere fast

Thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi all

sorry for rudimentary request but am stuck on simple wait for window, hit return(get out of antivirus advert window)

Current code gives high cpu utilisation

WinWaitActive ("Notifier of Avira AntiVir Personal - Free Antivirus")
Send("^{Return}")

I know I need to put some kind of wait/sleep function as this is intended to run all the time and probably some kind of loop so code keeps on running but I'm getting nowhere fast

Thanks

try this:

Opt("WinTitleMatchMode", 2)
While 1
WinWaitActive ("Notifier of Avira AntiVir Personal - Free Antivirus")
Send("^{Return}")
Sleep (100)
WEnd

This will make it an infinite loop and the Sleep(100) will drop CPU utilization dramatically, and the opt wintitlematchmode will make it so it will match any substring of the window title.

Edited by LurchMan

Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end.

Share this post


Link to post
Share on other sites

jonnybignote - The snippet you posted should not hog your CPU - post the entire relevant parts of your code so that we may examine it and find the real problem.


Das Häschen benutzt Radar.

Share this post


Link to post
Share on other sites

There is no way to force WinWaitActive to increase it's sleep. You need to build something that works the same way, like this:

Do
    Sleep(50)
Until WinActive("Notifier of Avira AntiVir Personal - Free Antivirus")
Send("^{Return}")

BUT!! There are a much easier way to disable the Avira Antivir nag screen, see http://www.elitekiller.com/files/disable_antivir_nag.htm

Share this post


Link to post
Share on other sites

First - thanks to all you guys for posting replies - much appreciated.

Opt("WinTitleMatchMode", 2)
While 1
WinWaitActive ("Notifier of Avira AntiVir Personal - Free Antivirus")
Send("^{Return}")
Sleep (100)
WEnd

No change with this unfortunately...

The snippet you posted should not hog your CPU - post the entire relevant parts of your code so that we may examine it and find the real problem.

That was the entire script...

There is no way to force WinWaitActive to increase it's sleep. You need to build something that works the same way, like this:

[ autoIt ] ( Popup )

Do Sleep(50) Until WinActive("Notifier of Avira AntiVir Personal - Free Antivirus") Send("^{Return}")

BUT!! There are a much easier way to disable the Avira Antivir nag screen, see http://www.elitekiller.com/files/disable_antivir_nag.htm

Thanks! - that code brought it down to 1-2% which is much more manageable - however I think I'll go with your other solution to avoid it altogether. Thanks again all as this helps me understand better for my future scripting projects!

Share this post


Link to post
Share on other sites

Thanks! - that code brought it down to 1-2% which is much more manageable - however I think I'll go with your other solution to avoid it altogether. Thanks again all as this helps me understand better for my future scripting projects!

No problem. I use Avira Antivir myself so I know how irritating the nag sceen can be :)

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