Generator Posted October 10, 2007 Share Posted October 10, 2007 (edited) This is a little tool I use in school, comes in handy if teacher/whatever checks on you. They will think you haven't touch you computer and it is on idle. Very easy to use and i guess you might like it.Source:expandcollapse popup#include<Misc.au3> _Singleton("Monitor Manager") Opt("MouseCoordMode", 1) Opt("WinTitleMatchMode", 4) Opt("TrayMenuMode", 1) Opt("TrayOnEventMode", 1) Opt("RunErrorsFatal", 0) Global Const $lciWM_SYSCommand = 274 Global Const $lciSC_MonitorPower = 61808 Global Const $lciPower_Off = 2 Global Const $lciPower_On = -1 Global $Msg = 1 $RegRead = RegRead("HKEY_CURRENT_USER\Control Panel\Desktop", "SCRNSAVE.EXE") $dll = DllOpen("user32.dll") $menu = TrayCreateItem("Help") $hwnd = WinGetHandle("classname=Progman") TrayItemSetOnEvent($menu, "_Help") While 1 If _IsPressed("01") And MouseGetPos(0) = 0 And MouseGetPos(1) = 0 Then While _IsPressed("01") Sleep(1) WEnd $Msg = Not $Msg If Not $Msg Then Do _Off() Sleep(1) Until _IsPressed("01") And MouseGetPos(0) = 0 And MouseGetPos(1) = 0 Else _On() EndIf EndIf If _IsPressed("02") And MouseGetPos(0) = 0 And MouseGetPos(1) = 0 Then While _IsPressed("02") Sleep(1) WEnd _On() _Bye() EndIf If _IsPressed("04") And MouseGetPos(0) = 0 And MouseGetPos(1) = 0 And $Msg Then While _IsPressed("04") Sleep(1) WEnd _ScreenSaver() EndIf Sleep(1) WEnd Func _Help() MsgBox(64, "Instruction", "To activate this, make appropriate click at top left screen" & @CRLF & @CRLF & "Left Button - Screen On/Off" & @CRLF & "Middle Button - Activate Screensaver" & @CRLF & "Right Button to exit program" & @CRLF & @CRLF & "This will close in 5 seconds", 5) EndFunc ;==>_Help Func _On() DllCall($dll, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_On) EndFunc ;==>_On Func _Off() DllCall($dll, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_Off) EndFunc ;==>_Off Func _Bye() Exit EndFunc ;==>_Bye Func _ScreenSaver() ShellExecute($RegRead) If @error Then TrayTip("Error", "This machine have no default screensaver", "", 1) EndFunc ;==>_ScreenSaver Edited October 12, 2007 by Generator Link to comment Share on other sites More sharing options...
JustinReno Posted October 10, 2007 Share Posted October 10, 2007 That's pretty cool! Link to comment Share on other sites More sharing options...
thenewkid Posted October 10, 2007 Share Posted October 10, 2007 nice script thow i dont like that you use the mouse to trun on or off maybe use shit+1 for off and shit+2 for on? just a idea some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with Link to comment Share on other sites More sharing options...
JustinReno Posted October 10, 2007 Share Posted October 10, 2007 nice script thow i dont like that you use the mouse to trun on or off maybe use shit+1 for off and shit+2 for on? just a ideaDid you forget your F key, lol. Link to comment Share on other sites More sharing options...
magician13134 Posted October 10, 2007 Share Posted October 10, 2007 (edited) nice script thow i dont like that you use the mouse to trun on or off maybe use shit+1 for off and shit+2 for on? just a idea Or maybe.... shift+1? Ahhhh, beat me to it! Nice script, by the way! I would just add #NoTrayIcon and make the help message box appear when you first run it, and yes, I also would like to see a keyboard shortcut Maybe like this expandcollapse popup#include<Misc.au3> #NoTrayIcon _Singleton("Monitor Manager") Opt("WinTitleMatchMode", 4) Opt("TrayMenuMode", 1) Opt("TrayOnEventMode", 1) Global Const $lciWM_SYSCommand = 274 Global Const $lciSC_MonitorPower = 61808 Global Const $lciPower_Off = 2 Global Const $lciPower_On = -1 Global $Msg = 1 HotKeySet("{Pause}", "_Bye") HotKeySet("+1", "_Off") HotKeySet("+2", "_On") _Help() $dll = DllOpen("user32.dll") $menu = TrayCreateItem("Help") $hwnd = WinGetHandle("classname=Progman") TrayItemSetOnEvent($menu, "_Help") While 1 If _IsPressed("01") And MouseGetPos(0) = 0 And MouseGetPos(1) = 0 Then While _IsPressed("01") Sleep(1) WEnd $Msg = Not $Msg If Not $Msg Then Do _Off() Sleep(1) Until _IsPressed("01") And MouseGetPos(0) = 0 And MouseGetPos(1) = 0 Else _On() EndIf EndIf If _IsPressed("02") And MouseGetPos(0) = 0 And MouseGetPos(1) = 0 Then While _IsPressed("02") Sleep(1) WEnd _On() _Bye() EndIf Sleep(1) WEnd Func _Help() MsgBox(64, "Instruction", "Left Click Top Left Screen - On/Off" & @CRLF & "Right Click Top Left Screen - Exit" & @CRLF & "Shift+1 - Hide" & @CRLF & "Shift + 2 - Show" & @CRLF & "Pause|Break - Exit" & @CRLF & @CRLF & @CRLF & "This will close in 5 seconds", 5) EndFunc ;==>_Help Func _On() DllCall($dll, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_On) EndFunc ;==>_On Func _Off() DllCall($dll, "int", "SendMessage", "hwnd", $hwnd, "int", $lciWM_SYSCommand, "int", $lciSC_MonitorPower, "int", $lciPower_Off) EndFunc ;==>_Off Func _Bye() Exit EndFunc ;==>_Bye Edited October 10, 2007 by magician13134 Visit Magic Soft Inc. for some of my software Link to comment Share on other sites More sharing options...
Generator Posted October 10, 2007 Author Share Posted October 10, 2007 There are few reasons i prefer mouse over key: - In any situation, left click on top left screen is the fastest - The reason top left screen is used because it is the least use spot in the screen - Even you can't see anything you can keep moving mouse to top left and make a click - AutoIt hotkey takes over all programs hotkey, though _IsPressed can be used but as i mentioned it is the fastest way and least effecting anything work or progress being made on computer Glad you all like it, change the script to suit your need. Link to comment Share on other sites More sharing options...
Generator Posted October 12, 2007 Author Share Posted October 12, 2007 Updated. Link to comment Share on other sites More sharing options...
pacman1176 Posted November 16, 2007 Share Posted November 16, 2007 Hey this is really useful, as I use my monitor as my Xbox 360 display, and whenever I want to switch over to the Xbox while the PC screen had priority, I would have to fiddle with the buttons on the monitor, now its one easy click Though there is one thing, I don't have a set screensaver, and when I do the wheel-click it doesn't give the prescribed error, but rather the folder directory of the script pops open. Link to comment Share on other sites More sharing options...
Generator Posted November 16, 2007 Author Share Posted November 16, 2007 Hey this is really useful, as I use my monitor as my Xbox 360 display, and whenever I want to switch over to the Xbox while the PC screen had priority, I would have to fiddle with the buttons on the monitor, now its one easy click Though there is one thing, I don't have a set screensaver, and when I do the wheel-click it doesn't give the prescribed error, but rather the folder directory of the script pops open. Glad you liked it, play with the source for you own need. Link to comment Share on other sites More sharing options...
gauss5546 Posted January 27, 2008 Share Posted January 27, 2008 Wow, awesome script. Link to comment Share on other sites More sharing options...
Achilles Posted January 28, 2008 Share Posted January 28, 2008 Nice script... I probably won't have much use for it, but it works well... One question though, why the limit of five seconds for a message box? My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
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