Jump to content

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


stounedi
 Share

Recommended Posts

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.

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

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...