Jump to content

Turning to monitor on


Recommended Posts

Hi guys... how can i turn the monitor back on when i turned it off...

i need it for a script. tnx already

edit:

i found this in a other post to turn it off

$WM_SYSCOMMAND = 274

$SC_MONITORPOWER = 61808

Opt('WinTitleMatchMode', 4)

$hwnd = WinGetHandle('classname=Progman')

DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', $WM_SYSCOMMAND, 'int',

$SC_MONITORPOWER, 'int', 2)

Edited by MarkMarkMark
Link to comment
Share on other sites

EDIT: A simple MouseMove(0,0) might even work. I guess I should stop assuming that people try stuff before asking

I have no idea if this will work, but it's worth a shot (Windows XP):

The sleep statements are for debugging and can be removed

Run(@ComSpec & " /c powercfg.cpl", "", @SW_HIDE)

$title = "Power Options Properties"

WinWait("Power Options Properties")
$count = ControlCommand($title, "", "ComboBox2", "FindString", ControlCommand($title,"","ComboBox2", "GetCurrentSelection","") )
ControlSend($title, "", "ComboBox2", "n")
ControlClick($title, "", "&Apply")
sleep(2000)
ControlSend($title, "", "ComboBox2", "{PgUp}{Down " & $count & "}")
sleep(2000)
ControlClick($title, "", "OK")
Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

Owyeah, and does someone know howto list other network computers that are online in a txt file?

<{POST_SNAPBACK}>

#Include <process.au3>
_RunDOS("net view > " & @ScriptDir & "\temp.txt")

Thinks thats what you meant.

Edited by Burrup

qq

Link to comment
Share on other sites

Hi guys... how can i turn the monitor back on when i turned it off...

i need it for a script. tnx already

edit:

i found this in a other post to turn it off

$WM_SYSCOMMAND = 274

$SC_MONITORPOWER = 61808

Opt('WinTitleMatchMode', 4)

$hwnd = WinGetHandle('classname=Progman')

DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', $WM_SYSCOMMAND, 'int',

$SC_MONITORPOWER, 'int', 2)

<{POST_SNAPBACK}>

Here is a working version of what you want to do. It's amazing how easy it is to find using the net. Good Luck. :)

$WM_SYSCOMMAND = 274

$SC_MONITORPOWER = 61808

$POWERON = -1

$POWEROFF = 2

$x = 1

Opt('WinTitleMatchMode', 4)

$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', $POWEROFF)

Else

$x = 1

DllCall('user32.dll', 'int', 'SendMessage', 'hwnd', $hwnd, 'int', $WM_SYSCOMMAND, 'int', $SC_MONITORPOWER, 'int', $POWERON)

EndIf

Sleep(10000)

WEnd

Kerby

Link to comment
Share on other sites

It seems that if you have @TempDir it works, but not with @ScriptDir.

#Include <process.au3>

_RunDOS("net view > " & @TempDir & "\temp.txt")

Msgbox(0,"Test","Your temp dir is :" & @TempDir)

Edit: Found out the problem, the path needs to be the 8.3 short path+name (ShortName). Maybe this should be included in the help file that when using _RunDos and you want to include a Macro , like above, it needs to be in short name.

#Include <process.au3>

_RunDOS("net view > " & FileGetShortName (@ScriptDir) & "\temp.txt")
Edited by Burrup

qq

Link to comment
Share on other sites

ah, i got it... now i've been messing arround with Fileread...

here's the story:

At the end of the textfile it creates a line (in dutch) :

De opdracht is voltooid.

howto read from line until the text "de opdracht is voltooid" ?

is it something:

$end = "de opdracht is voltooid"

If FileReadLine ( "temp.txt")

Until $end

Link to comment
Share on other sites

umm, that would never work i think.... ur missin a "("

@markmarkmark: voeg mij to bij msn, dan kan ik je in het nederlands even helpen, das makkelijker.

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Link to comment
Share on other sites

  • 2 weeks later...

I added a few functions to it and some other stuff. A little background into the changes though:

My computer has dual monitors, and is in my room, facing the bed, so its kinda hard to fall asleep with bright 17" looking at you. So at a preset time (variables in script), if ATIMMC (t.v. app) is running, its closed, and the monitors are disabled.

By hitting F7 And F9, the monitors come back on for 10 secs, and can be disabled again by ESC if not needed for 10 secs.

That's about it...now for the script!

Oh, I added the minutes capability just the other night (had to get to bed early for an AP exam :( ), but I don't know if it works correct yet or not...let me know please

midnight_shutdown.au3

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

  • 4 weeks later...

Owyeah, and does someone know howto list other network computers that are online in a txt file?

<{POST_SNAPBACK}>

$outputfile = "C:\some folder\List of LAN puters.txt"

Run(@ComSpec &' /c net view > "'& $outputfile &'"', "", @SW_HIDE)

Edited by trillian

[font="Arial"] ╩Q╩ [/font]

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...