Jump to content



Monitor Power Off


  • Please log in to reply
15 replies to this topic

#1 Guest_sbimdesign_*

Guest_sbimdesign_*
  • Guests

Posted 04 May 2005 - 07:24 AM

I would like to have a funktion to turn the monitor power off or sleep.
People sometimes should not see how the script works etc. create special accounts or directories remotely on public terminals.
Thanks.





#2 buzz44

buzz44

    Seriously funny.

  • Active Members
  • PipPipPipPipPipPip
  • 1,388 posts

Posted 04 May 2005 - 07:50 AM

Something like...
Plain Text         
Opt("WinTitleMatchMode', 4) $WM_SYSCommand = 274 $SC_MonitorPower = 61808 $Power_On = -1 $Power_Off = 2 $X = 1 $HWND = WinGetHandle("classname=Progman") While 1    If $X = 1 Then       $X = 0       DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", _       $SC_MonitorPower, "int", $Power_Off)    Else       $X = 1       DllCall("user32.dll", "int", "SendMessage", "hwnd", $HWND, "int", $WM_SYSCommand, "int", _       $SC_MonitorPower, "int", $Power_On)    EndIf    Sleep(10000) WEnd

Edited by Burrup, 04 May 2005 - 07:50 AM.

Old Projects:A3MORGB2HexOld Functions:_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

#3 kjactive

kjactive

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 697 posts

Posted 05 May 2005 - 05:49 PM

Nice dll call script - could take do a lot of other things like to activate the screensaver or open the 'start menu row'

Great direct call script 'Burrup'

kjactive :(

Edited by kjactive, 05 May 2005 - 05:50 PM.


#4 buzz44

buzz44

    Seriously funny.

  • Active Members
  • PipPipPipPipPipPip
  • 1,388 posts

Posted 06 May 2005 - 03:33 AM

Its not mine. Its from another recent topic, but when I see a script that could be useful I add it to my collection so when someone needs help its there. I'll try find out who the original creater was, or at least the person who posted it.

Edit: Found it. http://www.autoitscript.com/forum/index.ph...topic=10831&hl= Original poster : 'Kerberuz'.

Edited by Burrup, 06 May 2005 - 03:36 AM.

Old Projects:A3MORGB2HexOld Functions:_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

#5 kjactive

kjactive

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 697 posts

Posted 06 May 2005 - 07:27 AM

Okay but still a nice script, you write 'useful scripts into a collection, I do the same as to speed up programming and made out a special tool to do this, maybe this is something for you...

Au3Calibur: a excerpts manager to add usefull code into a libraries of snapped code, always at your fingertips control - no limit in amound of libraries created as to indexes included. I got a AutoIt, Html, temporary etc. - the application uses the clipboard to import/export as it can make direct interfase with SciTe and display Html directly...

Check it out - the application comes with an installer/uninstaller script and a topics included...

Download from site:
http://www.sitecenter.dk/latenight/nss-fol.../Au3Calibur.exe

kjactive :(

Edited by kjactive, 06 May 2005 - 07:32 AM.


#6 VicTT

VicTT

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 379 posts

Posted 12 May 2005 - 06:41 PM

One thing though..if you move the mouse while the monitor is off, or closing, it re-enables it..
const $WM_SYSCommand = 274,$SC_MonitorPower = 61808,$Power_On = -1,$Power_Off = 2 $HWND=WinGetHandle(WinGetTitle("","")) Func MonitorOff()     DllCall("user32.dll","int","SendMessage","hwnd",$HWND,"int",$WM_SYSCommand,"int",$SC_MonitorPower,"int",$Power_Off) EndFunc Func MonitorOn()     DllCall("user32.dll","int","SendMessage","hwnd",$HWND,"int",$WM_SYSCommand,"int",$SC_MonitorPower,"int",$Power_On) EndFunc $i=0 while $i<10 $i=$i+1 MonitorOff() Sleep(5000) MonitorOn() WEnd

Is there any way to fix that?

Together we might liveDivided we must fall


#7 MSLx Fanboy

MSLx Fanboy

    Local $Clue = 0

  • Active Members
  • PipPipPipPipPipPip
  • 1,046 posts

Posted 13 May 2005 - 02:30 AM

Updated my version of it again. It waits until its time to sleep, then shuts off the monitor, and keeps shutting it off even if keyboard/mouse activated. Can be overrode by F7+F9, for 10 seconds only.

Once it's time to wake up, it starts a browser window and opens to a streaming radio station (WJRR, Real Rock 101.1 of Orlando, FL), but keeps turning the monitor off for another 30 minutes.

Once it is between 06:45 and 6:55, the radio station browser window will close, and a forced reboot will ensue.

I'm a high school student, so I have this as my wakeup program. I also have trouble Remote Accessing this once I'm at school, if it has been left on for more than 24 hours...that's why there's a reboot.

A bit too much code for a post...script attached.

Attached Files


Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

#8 Cyclops

Cyclops

    Seeker

  • Active Members
  • 32 posts

Posted 13 May 2005 - 09:24 AM

wow, how do you learn to call the dlls? is there a tut or just experience?
Sorry for my cruel english :D

#9 sno

sno

    Seeker

  • Active Members
  • 21 posts

Posted 10 June 2005 - 07:50 AM

wow, how do you learn to call the dlls? is there a tut or just experience?

<{POST_SNAPBACK}>

^^ same question here :(
Grtx Sno. The Novice Newbie.

#10 Groumphy

Groumphy

    Adventurer

  • Active Members
  • PipPip
  • 128 posts

Posted 10 June 2005 - 01:40 PM

If I make a function :
Plain Text         
Func _Monitor($iNum) ; 0 = Off ; 1 = On ; failure = -1 ; success = -2     const $WM_SYSCommand = 274, $SC_MonitorPower = 61808, $Power_On = -1, $Power_Off = 2     $HWND = WinGetHandle(WinGetTitle("",""))     If $iNum = 0 Then         DllCall("user32.dll","int","SendMessage","hwnd",$HWND,"int",$WM_SYSCommand,"int",$SC_MonitorPower,"int",$Power_Off)                 If @error Then             Return -1         Else             Return -2         EndIf         Exit     ElseIf $iNum = 1 Then         DllCall("user32.dll","int","SendMessage","hwnd",$HWND,"int",$WM_SYSCommand,"int",$SC_MonitorPower,"int",$Power_On)         If @error Then             Return -1         Else             Return -2         EndIf         Exit     Else         Return -1         Exit     EndIf EndFunc; _Monitor(1)


Is it OK ?
----------------------GroumphyMore information about me [Fr]

#11 NoName4ever

NoName4ever

    Seeker

  • New Members
  • 4 posts

Posted 23 September 2005 - 08:29 PM

The problem is I play a game in my laptop. It need to send many keystrokes, so the monitor is switching on/off many times. Do we have any way to just swith it off and only turm on when press a hot key?

#12 MSLx Fanboy

MSLx Fanboy

    Local $Clue = 0

  • Active Members
  • PipPipPipPipPipPip
  • 1,046 posts

Posted 23 September 2005 - 09:04 PM

I've never tried this, but try uninstalling the monitor from the device list ;)
Writing AutoIt scripts since
_DateAdd("d", -2, _NowCalcDate())

#13 NoName4ever

NoName4ever

    Seeker

  • New Members
  • 4 posts

Posted 23 September 2005 - 09:22 PM

It's not a wise choice.
I'm thinking of a global Windows hook.....

#14 Guest_Guest_*

Guest_Guest_*
  • Guests

Posted 20 January 2008 - 08:24 AM

Just though incase anyone was searching for something like this in future reference, to activate this by a hotkey you just need to add a bit of sleep time ( Sleep(200) )
That fixes it turning back on. I was just doing this in VB.NET but I didn't know how to call a dll from Autoit. Sweet.

#15 BrettF

BrettF

    My Drunk Monkey Guerilla is gonna getcha!

  • MVPs
  • 7,662 posts

Posted 20 January 2008 - 08:52 AM

Just though incase anyone was searching for something like this in future reference, to activate this by a hotkey you just need to add a bit of sleep time ( Sleep(200) )
That fixes it turning back on. I was just doing this in VB.NET but I didn't know how to call a dll from Autoit. Sweet.

Way to bump a age old topic...

#16 Xenobiologist

Xenobiologist

    Xx Code~Mega xX

  • MVPs
  • 4,727 posts

Posted 20 January 2008 - 01:15 PM

Hi,

_SendMessage in helpfile.

Mega

Scripts & functions Organize Includes Let Scite organize the include files *newYahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication)_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users