ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

Screensaver Timeout Changer

(1/1)

Ordstrin:
Alright, at the suggestion of lanux.. here's the source.

Maybe this should be moved until the program is working?
50th edit lucky right? I hope...

Spoiler#SingleInstance, Force
#NoTrayIcon

Gui, Add, Button, x6 y10 w100 h30 gChangeButton, Change
Gui, Add, Button, x136 y10 w100 h30 gSetToDefault, Default
Gui, Add, Button, x266 y10 w100 h30 gExitButton, Exit
Gui, Add, GroupBox, x6 y50 w360 h100 , Time to wait before starting screensaver.
Gui, Add, Radio, x26 y70 w50 h20 vRadioChosen gRadioChange, Hours
Gui, Add, Radio, x116 y70 w60 h20 Checked1 gRadioChange, Minutes
Gui, Add, Radio, x216 y70 w60 h20 gRadioChange, Seconds
Gui, Add, Edit, x46 y110 w20 h20 Limit2 +Number +Disabled -HScroll vHoursTime,
Gui, Add, Edit, x126 y110 w30 h20 Limit4 +Number -HScroll vMinutesTime,
Gui, Add, Edit, x226 y110 w40 h20 Limit5 +Number +Disabled -HScroll vSecondsTime,
Gui, Show, x257 y231 h162 w376, Screensaver Timeout Changer
Return

ChangeButton:
Gui, Submit, NoHide

IfEqual, RadioChosen, 1
  {
  IfNotEqual, HoursTime,
    {
   TimeVar1:=(HoursTime*3600)
   
   TimeInMinutes:=(HoursTime*60)
   
   RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, ScreenSaveTimeOut, %TimeVar1%
   
   MsgBox, Screensaver Timeout has been changed to: %HoursTime% Hours (%TimeInMinutes% Minutes) (%TimeVar1% Seconds)
   }
   Else
   {
   MsgBox, Error: You must enter a number.
   }
  }

IfEqual, RadioChosen, 2
  {
  IfNotEqual, MinutesTime,
    {
   TimeVar1:=(MinutesTime*60)
   
   RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, ScreenSaveTimeOut, %TimeVar1%
   
   MsgBox, Screensaver Timeout has been changed to: %MinutesTime% Minutes (%TimeVar1% Seconds)
   }
   Else
   {
   MsgBox, Error: You must enter a number.
   }
  }

IfEqual, RadioChosen, 3
  {
  IfNotEqual, SecondsTime,
    {
   TimeVar1:=(SecondsTime*1)

   RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, ScreenSaveTimeOut, %TimeVar1%
   
   MsgBox, Screensaver Timeout has been changed to: %TimeVar1% Seconds
   }
   Else
   {
   MsgBox, Error: You must enter a number.
   }
  }

return

RadioChange:
Gui, Submit, NoHide

IfEqual, RadioChosen, 1
  {
  GuiControl, Enable, HoursTime
  GuiControl, Disable, MinutesTime
  GuiControl, Disable, SecondsTime
  }

IfEqual, RadioChosen, 2
  {
  GuiControl, Disable, HoursTime
  GuiControl, Enable, MinutesTime
  GuiControl, Disable, SecondsTime
  }

IfEqual, RadioChosen, 3
  {
  GuiControl, Disable, HoursTime
  GuiControl, Disable, MinutesTime
  GuiControl, Enable, SecondsTime
  }
 
return

SetToDefault:
RegWrite, REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, ScreenSaveTimeOut, 600
MsgBox, Screensaver Timeout has been changed to Default: 10 Minutes (600 Seconds)
return

ExitButton:
ExitApp
return

GuiClose:
ExitApp

It modifies the correct registry setting, but that doesn't make any difference.

lanux128:
why not post the source? i'm sure there are some knowledgeable AHK coders here to advise you. ;)

also Skrommel has written a few screensaver related scripts (right now, only RunSaver comes to mind) and you can pick up a few pointers from there.

Ordstrin:
Yet again, sound advice from a member of DC. I'll do just that I think.

lanux128:
looking from your code, i did something a while ago (changes to the registry i mean) and had the same result. the new value is written to the registry but it's not recognized by windows. there must be a way to refresh the registry programatically. i'll let you know if i find out anything. :)

Navigation

[0] Message Index

Go to full version