Peter Smick Posted March 16, 2010 Posted March 16, 2010 (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 March 18, 2010 by Peter Smick
omikron48 Posted March 16, 2010 Posted March 16, 2010 (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 March 16, 2010 by omikron48
Steveiwonder Posted March 16, 2010 Posted March 16, 2010 (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 March 16, 2010 by Steveiwonder They call me MrRegExpMan
Peter Smick Posted March 18, 2010 Author Posted March 18, 2010 (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 March 18, 2010 by Peter Smick
macro69 Posted February 24, 2014 Posted February 24, 2014 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
Moderators Melba23 Posted February 24, 2014 Moderators Posted February 24, 2014 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
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