Sign in to follow this  
Followers 0
Peter Smick

Solved! Registry Screensaver Setting updates

6 posts in this topic

#1 ·  Posted (edited)

Hi all,

I have a script that makes several changes to the user's (XP) screensaver settings by writing to the registry. It periodically checks the user's screensaver settings to make sure the user does not disable the screensaver (but still allows the user his/her choice of screensavers) and also checks that the user does not set a timeout value any higher than X minutes. I have chosen not to use Group Policies because they are too restrictive.

Unfortunately, although the script properly writes the screensaver timeout settings into the registry, the Display control panel does not READ the registry changes the script makes, and so they are ineffective. By contrast, if the user tries to turn off the screensaver by selecting None, the next time the script checks, it will select a default screensaver for the user, and this setting change IS recognized by the Display control panel in the current session. I think certain registry settings must be read only at login and not thereafter, and the screensaver timeout must be one of them.

Is there some way to force Display to update ALL its settings from the registry?

Thanks in advance,

Peter

Edited by Peter Smick

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I made a script for changing screen saver settings on XP using AutoIt. Here.

The method I used utilizes both the registry and SystemParametersInfo.

Edited by omikron48

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Something like this...

While 1
    WinWait($WinTitle)
    If ControlCommand($WinTitle, "", 12320, "CurrentTab") = 3 Then ; "Screen Saver" Tab Selected
        ControlCommand($WinTitle, "", 1300, "DelString", "(None)") ; Delete the "None" option so screen saver cannot be disabled.
        While 1
            If ControlGetText($WinTitle, "", 1306) > $MaxTimeout Then
                ControlSetText($WinTitle, "", 1306, $MaxTimeout) ; Set Value
            EndIF

            If Not WinExists($WinTitle) Then ExitLoop ; User Closes Display Properties window
            sleep(50)
        WEnd

    EndIf

    Sleep(100)
WEnd

Hope it helps

Edits: Identation Ammendments

Edited by Steveiwonder

They call me MrRegExpMan

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thank you very much. I tried both methods and they do the job. Using omikron48's function I tested what the user had set at any time during a 5 minute polling interval and called the function whenever the user made an improper setting. I had to be careful not to call the function if no changes were necessary, because each time the function runs, the screensaver timer gets reset. So the screensaver never kicked in (unless the user timeout was less than the polling interval).

Steviwonder's direct method doesn't allow the user to make impermissible changes in the first place. I added a msgbox to remind the user why the Wait field was not permitting them to enter an impermissible value, and I also added a ControlCommand after the first WEND to put the None choice back so that when the script is not running (e.g. they are logged off our network) they are free to set no screensaver if they want to. I guess the only way this method would get defeated is if the user figured out a way to set screensaver settings without using the Display panel applet--pretty unlikely.

Thanks again.

PS

Edited by Peter Smick

Share this post


Link to post
Share on other sites

Thank you very much. I tried both methods and they do the job. Using omikron48's function I tested what the user had set at any time during a 5 minute polling interval and called the function whenever the user made an improper setting. I had to be careful not to call the function if no changes were necessary, because each time the function runs, the screensaver timer gets reset. So the screensaver never kicked in (unless the user timeout was less than the polling interval).

Steviwonder's direct method doesn't allow the user to make impermissible changes in the first place. I added a msgbox to remind the user why the Wait field was not permitting them to enter an impermissible value, and I also added a ControlCommand after the first WEND to put the None choice back so that when the script is not running (e.g. they are logged off our network) they are free to set no screensaver if they want to. I guess the only way this method would get defeated is if the user figured out a way to set screensaver settings without using the Display panel applet--pretty unlikely.

Thanks again.

PS

Hi Peter, 

I'm a newbie, interested in how to modify registry to turn on screen saver, would you mind to share your code?

Many thanks

Share this post


Link to post
Share on other sites

macro69,

Seeing that the OP has not been online since Sep 2010 I hope you are not expecting a quick reply. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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