topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday April 26, 2024, 6:22 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: A couple small modifications to TrayScreenSaver  (Read 5493 times)

VodkaL

  • Participant
  • Joined in 2010
  • *
  • default avatar
  • Posts: 1
    • View Profile
    • Donate to Member
A couple small modifications to TrayScreenSaver
« on: February 07, 2010, 12:47 AM »
Tell me what you think, and feel free to use it.

Code: AutoIt [Select]
  1. ;TrayScreenSaver.ahk
  2. ; Control the screensaver from the tray
  3. ;Skrommel @ 2006
  4.  
  5. #SingleInstance,Force
  6. #Persistent
  7.  
  8. applicationname=TrayScreenSaver
  9.  
  10. Gosub,TRAYMENU
  11. Gosub,ACTIVE
  12.  
  13.  
  14. TRAYMENU:
  15. savers=
  16. Loop,%A_WinDir%\*.scr
  17.   savers=%savers%%A_LoopFileName%`n
  18. Loop,%A_WinDir%\System32\*.scr
  19.   savers=%savers%%A_LoopFileName%`n
  20. StringSplit,savers_,savers,`n
  21. savers_0-=1
  22.  
  23. Menu,Tray,Click,1
  24. Menu,Tray,NoStandard
  25. Menu,Tray,DeleteAll
  26. Menu,Tray,Add,%applicationname%,DOUBLECLICK
  27. Menu,Tray,Add,
  28.  
  29. Menu,savermenu,add,
  30. Menu,tray,add,Saver Menu, :savermenu
  31.  
  32. Loop,%savers_0%
  33. {
  34.   screensaver:=savers_%A_Index%
  35.   Menu,savermenu,Add,%screensaver%,SELECT
  36. }
  37.  
  38. Menu,Tray,Add,
  39. Menu,Tray,Add,Power &Off Monitor,Off
  40. Menu,Tray,Add,&Run,RUN
  41. Menu,Tray,Add,&Enabled,TOGGLE
  42. Menu,Tray,Add,&Settings...,SETTINGS
  43. Menu,Tray,Add,
  44. Menu,Tray,Add,&About...,ABOUT
  45. Menu,Tray,Add,E&xit,EXIT
  46.  
  47. Menu,Tray,Default,%applicationname%
  48. Menu,Tray,Check,&Enabled
  49. Menu,Tray,Tip,%applicationname%
  50.  
  51.  
  52.  
  53. Run,%A_ThisMenuItem% /s
  54.  
  55.  
  56. SINGLECLICK:
  57. SetTimer,SINGLECLICK,Off
  58. clicks=
  59. Gosub,TOGGLE
  60.  
  61.  
  62. DOUBLECLICK:
  63. If clicks=
  64. {
  65.   SetTimer,SINGLECLICK,500
  66.   clicks=1
  67.   Return
  68. }
  69. SetTimer,SINGLECLICK,Off
  70. clicks=
  71. Gosub,RUN
  72.  
  73.  
  74. TOGGLE:
  75. RegRead,active,HKEY_CURRENT_USER,Control Panel\Desktop,ScreenSaveActive
  76. If active=1
  77.   active=0
  78.   active=1
  79. RegWrite,Reg_SZ,HKEY_CURRENT_USER,Control Panel\Desktop,ScreenSaveActive,%active%
  80. Gosub,ACTIVE
  81.  
  82.  
  83. ACTIVE:
  84. RegRead,active,HKEY_CURRENT_USER,Control Panel\Desktop,ScreenSaveActive
  85. If active=1
  86. {
  87.   Menu,Tray,Icon,%applicationname%.exe,1,1
  88.   Menu,Tray,Check,&Enabled
  89. }
  90. {
  91.   Menu,Tray,Icon,%applicationname%.exe,4,4
  92.   Menu,Tray,UnCheck,&Enabled
  93. }
  94.  
  95.  
  96. RegRead,screensaver,HKEY_CURRENT_USER,Control Panel\Desktop,ScrnSave.Exe
  97. IfInString,screensaver,.scr
  98.   Run,%screensaver% /s
  99.   Gosub,SETTINGS
  100.  
  101. Off:
  102. Sleep 1000
  103. SendMessage, 0x112, 0xF170, 2,, Program Manager
  104.  
  105. SETTINGS:
  106. RegRead,screensaver,HKEY_CURRENT_USER,Control Panel\Desktop,ScrnSave.Exe
  107. Run,rundll32.exe desk.cpl`,InstallScreenSaver %screensaver%
  108.  
  109.  
  110. ABOUT:
  111. Gui,99:Destroy
  112. Gui,99:Margin,20,20
  113. Gui,99:Add,Picture,xm Icon1,%applicationname%.exe
  114. Gui,99:Font,Bold
  115. Gui,99:Add,Text,x+10 yp+10,%applicationname% v1.0
  116. Gui,99:Font
  117. Gui,99:Add,Text,y+10,Control the screensaver from the tray
  118. Gui,99:Add,Text,y+5,- Singleclick to enable or disable the screensaver
  119. Gui,99:Add,Text,y+5,- Doubleclick the tray icon to run the default screensaver
  120. Gui,99:Add,Text,y+5,- Run any screensaver from the tray menu
  121. Gui,99:Add,Text,y+5,- Change settings using Settings in the tray menu
  122.  
  123. Gui,99:Add,Picture,xm y+20 Icon5,%applicationname%.exe
  124. Gui,99:Font,Bold
  125. Gui,99:Add,Text,x+10 yp+10,1 Hour Software by Skrommel
  126. Gui,99:Font
  127. Gui,99:Add,Text,y+10,For more tools, information and donations, please visit
  128. Gui,99:Font,CBlue Underline
  129. Gui,99:Add,Text,y+5 G1HOURSOFTWARE,www.1HourSoftware.com
  130. Gui,99:Font
  131.  
  132. Gui,99:Add,Picture,xm y+20 Icon7,%applicationname%.exe
  133. Gui,99:Font,Bold
  134. Gui,99:Add,Text,x+10 yp+10,DonationCoder
  135. Gui,99:Font
  136. Gui,99:Add,Text,y+10,Please support the contributors at
  137. Gui,99:Font,CBlue Underline
  138. Gui,99:Add,Text,y+5 GDONATIONCODER,www.DonationCoder.com
  139. Gui,99:Font
  140.  
  141. Gui,99:Add,Picture,xm y+20 Icon6,%applicationname%.exe
  142. Gui,99:Font,Bold
  143. Gui,99:Add,Text,x+10 yp+10,AutoHotkey
  144. Gui,99:Font
  145. Gui,99:Add,Text,y+10,This tool was made using the powerful
  146. Gui,99:Font,CBlue Underline
  147. Gui,99:Add,Text,y+5 GAUTOHOTKEY,www.AutoHotkey.com
  148. Gui,99:Font
  149.  
  150. Gui,99:Show,,%applicationname% About
  151. hCurs:=DllCall("LoadCursor","UInt",NULL,"Int",32649,"UInt") ;IDC_HAND
  152. OnMessage(0x200,"WM_MOUSEMOVE")
  153.  
  154. 1HOURSOFTWARE:
  155.   Run,http://www.1hoursoftware.com,,UseErrorLevel
  156.  
  157. DONATIONCODER:
  158.   Run,http://www.donationcoder.com,,UseErrorLevel
  159.  
  160. AUTOHOTKEY:
  161.   Run,http://www.autohotkey.com,,UseErrorLevel
  162.  
  163. 99GuiClose:
  164.   Gui,99:Destroy
  165.   OnMessage(0x200,"")
  166.   DllCall("DestroyCursor","Uint",hCur)
  167.  
  168. WM_MOUSEMOVE(wParam,lParam)
  169. {
  170.   Global hCurs
  171.   MouseGetPos,,,,ctrl
  172.   If ctrl in Static10,Static14,Static18
  173.     DllCall("SetCursor","UInt",hCurs)
  174. }
  175.  
  176.  
  177. ExitApp

If you dont have his icons and compile the script, you can just put the script in the same folder as his exe and run the script
VodkaL
« Last Edit: February 07, 2010, 01:02 AM by VodkaL »