WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: jfrasier on December 30, 2013, 02:13:45 PM

Title: Use a winbatch script as a screensaver
Post by: jfrasier on December 30, 2013, 02:13:45 PM
Basically after a certain amount of time has passed without mousemoves or keystrokes, I want the application to close and then reopen. I thought maybe writing a script, compiling it and then renaming it with a .scr extension might work. It does sort of. Here are the lines of code:

currentwin = WinGetActive()
WinClose(currentwin)
timedelay(3)
Run("C:\Program Files\Google\Chrome\Application\chrome.exe","")

It closes Chrome fine, but it doesn't open it back up. Actually I think it does for a split second and then closes it again.

Any ideas? Thanks

Jane
Title: Re: Use a winbatch script as a screensaver
Post by: jfrasier on December 31, 2013, 08:43:43 AM
If I just run it as an .exe it does start the program.
Title: Re: Use a winbatch script as a screensaver
Post by: snowsnowsnow on December 31, 2013, 11:34:58 AM
I'm guessing the problem is that when the screensaver is active, the "normal" desktop is not connected, so your WinClose won't work.

You probably have to "unscreensaver" it (I think this is possible, I just forget how to do it ATM), then do your WinClose.
Title: Re: Use a winbatch script as a screensaver
Post by: jfrasier on December 31, 2013, 01:12:32 PM
It does close the window. What it doesn't do is Run Chrome.
Title: Re: Use a winbatch script as a screensaver
Post by: Deana on January 02, 2014, 09:38:18 AM
Maybe rather than treating the compiled script as a screen saver, try this method instead:http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/tsleft.web+WinBatch/Launching~WinBatch~and~Other~Apps+Launch~Exe~after~Period~of~Inactivity.txt