The How-To Geek Forums Have Migrated to Discourse


How-To Geek Forums / Geek Stuff

Improving a VBScript that toggles the Screen Saver

(1 post)
  • Started 7 years ago by selvan777
  • Topic Viewed 1554 times

PARTNER SPOTLIGHT

Recommended: Clean Your Mac the Easy Way with CleanMyMac 3

If you want to clean up your Mac the easy way, CleanMyMac is a great tool to get the job done easily, and it will even keep your computer clean automatically.

Unlike the competition, it also includes great tools like a Clean Uninstaller, to get rid of applications and clean up the junk that they leave behind. All with the click of a button.

Download CleanMyMac 3 for Free Today

Posted yesterday 
Top
selvan777
Posts: 1

As is, when opened, it toggles the screen saver on or off.

I'd like to know how to change it so when opened, it displays a message box showing the current value while offering a couple choices, "Ok" to toggle it and "Cancel".

The Script:

Const HKCU = &H80000001
Set oReg=GetObject("winmgmts:!root/default:StdRegProv")
oReg.GetStringValue HKCU,"control panel\desktop","ScreenSaveActive",screensaveractive
Select case screensaveractive
case "1″
screensaveractive = "0″
oReg.SetStringValue HKCU,"control panel\desktop","ScreenSaveActive",screensaveractive
msgbox "Disabled",vbinformation,"Screen Saver Switch"
Case "0″
screensaveractive = "1″
oReg.SetStringValue HKCU,"control panel\desktop","ScreenSaveActive",screensaveractive
msgbox "Enabled",vbinformation,"Screen Saver Switch"
End Select

Posted 7 years ago
Top
 



Topic Closed

This topic has been closed to new replies.