stounedi Posted November 20, 2012 Share Posted November 20, 2012 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 More sharing options...
JohnOne Posted November 21, 2012 Share Posted November 21, 2012 While 1 If Not WinActive("[windowname]") Then WinActivate ("[windowname]") EndIf 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 More sharing options...
stounedi Posted November 21, 2012 Author Share Posted November 21, 2012 (edited) 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 November 21, 2012 by stounedi Link to comment Share on other sites More sharing options...
JohnOne Posted November 21, 2012 Share Posted November 21, 2012 Put this at top of script Opt("WinTitleMatchMode",2) It will match windowname - 1232 1234 - windowname 12 - windowname - 34 etc.. 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 More sharing options...
stounedi Posted November 21, 2012 Author Share Posted November 21, 2012 Hmm, if I have two windows with same starting but other one has extra in the end, say:Prog - c:xxxyyyandProgI 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. Link to comment Share on other sites More sharing options...
JohnOne Posted November 21, 2012 Share Posted November 21, 2012 Right. 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 More sharing options...
stounedi Posted November 21, 2012 Author Share Posted November 21, 2012 Damn, seems the script will deactivate screensaver. Is there any way to detect if screensaver is active before focusing the window? Link to comment Share on other sites More sharing options...
JohnOne Posted November 21, 2012 Share Posted November 21, 2012 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 More sharing options...
stounedi Posted November 21, 2012 Author Share Posted November 21, 2012 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 Link to comment Share on other sites More sharing options...
JohnOne Posted November 21, 2012 Share Posted November 21, 2012 Great news. Good luck with project. 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now