aphesia Posted February 17, 2009 Share Posted February 17, 2009 (edited) #include <Timers.au3>;same as Timers.au3Opt("WinTitleMatchMode", -2); Makes it case insensitive, but still substringFunc Monitor($io_control = "on") Local $WM_SYSCommand = 274 Local $SC_MonitorPower = 61808 Local $HWND = WinGetHandle("classname=Progman") Switch StringUpper($io_control) Case "OFF" DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", $SC_MonitorPower, "int", 2) Case "ON" DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", $SC_MonitorPower, "int", -1) Case Else MsgBox(32, @ScriptName, "Command usage: on/off") EndSwitchEndFuncwhile 1 If _Timer_GetIdleTime() > "5000" Then if WinActive("dvd") = 0 And WinActive("firefox") = 0 And WinActive("player") = 0 Then Monitor("off") EndIf EndIf WEndit should work.. but it doesnt why ? also tried to give the whole func thigny on the end (after wend) but will dont work. Edited February 17, 2009 by aphesia Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 17, 2009 Share Posted February 17, 2009 (edited) it should work.. but it doesnt why ? also tried to give the whole func thigny on the end (after wend) but will dont work. Are you saying the window does not receive the message? That message is sent on an event (changing the monitor power state). I don't think it will cause the monitor to change state. Edit: I was wrong, it does work. Edited February 17, 2009 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
aphesia Posted February 17, 2009 Author Share Posted February 17, 2009 this turns of the monitor: #include <Timers.au3>Opt("WinTitleMatchMode", 4)_Timer_GetIdleTime()Monitor("off")Func Monitor($io_control = "on") Local $WM_SYSCommand = 274 Local $SC_MonitorPower = 61808 Local $HWND = WinGetHandle("classname=Progman") Switch StringUpper($io_control) Case "OFF" DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", $SC_MonitorPower, "int", 2) Case "ON" DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", $SC_MonitorPower, "int", -1) Case Else MsgBox(32, @ScriptName, "Command usage: on/off") EndSwitchEndFuncmy script (above) should do it after a time of inacitivty.. but it doesnt Link to comment Share on other sites More sharing options...
PsaltyDS Posted February 17, 2009 Share Posted February 17, 2009 this turns of the monitor: my script (above) should do it after a time of inacitivty.. but it doesnt Well, I was wrong. It works fine for me and turns the monitor off until I move the mouse.Are you sure the monitor you have supports power management? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Envoi Posted February 17, 2009 Share Posted February 17, 2009 (edited) Your first script isn't finding "classname=Progman" because you've set the window match mode to -2. Put this at the top of your Monitor function: Opt("WinTitleMatchMode", 4) You can set it back to -2 if you want before exiting your function. Hope that helps. --Kris EDIT: Even easier, yet; don't change the "Opt" just change "classname=Progman" to "Program Manager" Edited February 17, 2009 by Envoi 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