Sign in to follow this  
Followers 0
vnavna

Postpone screensaver until script finishes

11 posts in this topic

Is there any way to postpone the screen saver until after a long script may run? I have put in some simple refresh commands of sending a simple Send ("#d {F5 2}"). Is there any other way?

Share this post


Link to post
Share on other sites



Move the mouse.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Don't worry I got it figured out. All I did was run a file at the start of the script consisting of the following

RunWait(@ComSpec & " /c " & "regedit -s \\UNC Path\screesaveroff.reg","",@SW_HIDE) Inside of the reg file is the following.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop]

"ScreenSaveActive"="0"

And when the script finishes I run another

RunWait(@ComSpec & " /c " & "regedit -s \\UNC Path\screesaveron.reg","",@SW_HIDE)

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop]

"ScreenSaveActive"="1"

This seems to work. This is going to work for me because my settings are getting deployed through a Group Policy. if you don't use a GPO you have to go to a different place in the registry. HKEY_CURRENT_USER\Control Panel\Desktop and make your changes.

Share this post


Link to post
Share on other sites

Registry import don't have immediate action.

Here is another way...

#include <A3LWinAPI.au3>

;~ Disable
_API_SystemParametersInfo($SPI_SETSCREENSAVEACTIVE,0,0,$SPIF_UPDATEINIFILE)
ConsoleWrite('ScreenSaveActive: ' & RegRead('HKEY_CURRENT_USER\Control Panel\Desktop','ScreenSaveActive') & @LF)

;~ Enable
_API_SystemParametersInfo($SPI_SETSCREENSAVEACTIVE,1,0,$SPIF_UPDATEINIFILE)
ConsoleWrite('ScreenSaveActive: ' & RegRead('HKEY_CURRENT_USER\Control Panel\Desktop','ScreenSaveActive') & @LF)

Share this post


Link to post
Share on other sites

I will give that a try. THX

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Hello vnavna,

I banged my head against this very issue last week.

Problem is, our screen saver settings are deployed via Group Policies and I'm unable to locate [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop] from my non-admin account (GO SECURITY!).

From my understanding of the TechNet documentation, group policy trumps "HKEY_CURRENT_USER\Control Panel\Desktop" settings such that I can disable my screen saver registry settings all day long, but the group policy settings will always win out.

Has this been your experience as well? I'm not looking to hack around it, but I couldn't disable the screensaver using any non-admin reg settings I could find. Perhaps I'm misunderstanding all this ( wouldn't be the first time ).

Thanks,

Zach...

Edited by zfisherdrums

Share this post


Link to post
Share on other sites

Don't worry I got it figured out. All I did was run a file at the start of the script consisting of the following

RunWait(@ComSpec & " /c " & "regedit -s \\UNC Path\screesaveroff.reg","",@SW_HIDE) Inside of the reg file is the following.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop]

"ScreenSaveActive"="0"

Why use a .reg file? Why not use RegRead and RegWrite


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

Can that be ran under a non-admin person?

Share this post


Link to post
Share on other sites

I don't know....I don't run a non-admin account. Try it with your computer and see what happens.


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Here is the trick with Policy...

Read Screen Saver timeout value from the registry and just enable the ScreenSaver again before it times out. This will reset the Screen Saver timer.

You have to use API call like my above post.

Edited by Joon

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  
Followers 0