Jump to content
Sign in to follow this  

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

Recommended Posts


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]")

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

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

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

Prog - c:xxxyyy



I could use Opt("WinTitleMatchMode",2)


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

Sorry, my mistake, try this


While 1
    If Not WinActive("[windowname]") And Not ProcessExists("scrnsave.scr") Then

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

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...