Jump to content
Sign in to follow this  
stounedi

Newbie help: Auto-focus window but allow Windows Screensaver?

Recommended Posts

stounedi

Hey!

I have succesfully created a script that automatically keeps focus on a certain window (and loops forever).

But while the script runs it seems Windows screensaver isnt activating.

Below my script:

While 1 = 1
   WinActivate ("[windowname]")
   WEnd

I'd like to know how to make a script that focuses the window only when screensaver is not running. And if screensaver is running it would focus screensaver.

I know that if I choose from the program I focus to "always on top" it will go over Windows screensaver, so I suspect the screensaver does run but the program window stays on top of it.

Or does my script prevent screensaver from running totally? I run it as an exe.

Share this post


Link to post
Share on other sites
stounedi

Thank you for your reply!

Does the If sentence work, if the program window has a changing title for example Program - Page X -> Program - Page Y

Or is there a wildcard I could use with WinActive (for example ("[windowname*]"))?

Sorry for being such a noob but I am a total noob with AutoIt :)

Edited by stounedi

Share this post


Link to post
Share on other sites
stounedi

Hmm, if I have two windows with same starting but other one has extra in the end, say:

Prog - c:xxxyyy

and

Prog

I could use Opt("WinTitleMatchMode",2)

Then:

WinActivate ("[Prog - ]")

It would work only for the window that has the extra ending, right?

And thank you very much for your help, again.

Share this post


Link to post
Share on other sites
stounedi

Damn, seems the script will deactivate screensaver.

Is there any way to detect if screensaver is active before focusing the window?

Share this post


Link to post
Share on other sites
JohnOne

Sorry, my mistake, try this

Opt("WinTitleMatchMode",2)

While 1
    If Not WinActive("[windowname]") And Not ProcessExists("scrnsave.scr") Then
        WinActivate("[windowname]")
    EndIf
    Sleep(100)
WEnd

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
stounedi

That worked, I just changed "scrnsave.scr" to whatever screensaver I'm really using.

Thanks a lot, I also learned a good lesson about AutoIt :)

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  

×