Jump to content

Solved! Registry Screensaver Setting updates


Recommended Posts

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

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

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

Edited by Peter Smick
Link to comment
Share on other sites

  • 3 years later...

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

Link to comment
Share on other sites

  • Moderators

macro69,

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

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

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...