Jump to content
Sign in to follow this  

Shutdown function help

Recommended Posts


Hi guys. I'm writing a shutdown timer and i can get my PC to shutdown using 1 + 8 = 9 no problem but when i want it top go into sleep mode It gives me problems. I've tried using 32, 64, and 96 but none of these put the PC into sleep mode like win7 does.

Share this post

Link to post
Share on other sites

Please post some example code. It's really hard to help without it.

#fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja!

Share this post

Link to post
Share on other sites

The shutdown function is at the end of the loop.

#include <GUIConstantsEx.au3>

$Form1 = GUICreate("Sleep Timer", 200, 150, 193, 115)
$Input1 = GUICtrlCreateInput("Minutes to Sleep", 50, 80, 100, 21)
$Button1 = GUICtrlCreateButton("OK", 50, 110, 100, 30, 0)
$Check1 = GUICtrlCreateRadio("Shutdown", 50, 20)
$Check2 = GUICtrlCreateRadio("Sleep", 50, 40)
GUISetState(@SW_SHOW) ; set the gui state to show so you can see it 

While 1 ; start of loop
    $Msg = GUIGetMsg()  
        Case $Msg = $GUI_EVENT_CLOSE ; exit if the window is closed
        Case $Msg = $Input1 ; grab input of minutes and multiply by 60000 to get time in miliseconds
            $Mins = GUICtrlRead ($Input1)
            $Min = 60000 * $Mins            
        Case $Msg = $Check1 ; if shutdown is selected asign 1 to $End
            $End = 1
        Case $Msg = $Check2 ; if sleep is selected asign 2 to $End
            $End = 2
        Case $Msg = $Button1 ; run the sleep timer
            If $End = 1 Then
                Shutdown (9)
            ElseIf $End = 2 Then
                Shutdown (64) ;;; This is where i can't get windows to sleep ;;;

Share this post

Link to post
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
Sign in to follow this