Sign in to follow this  
Followers 0
Kyme

Shutdown command after some time

5 posts in this topic

how i can make it to shutdown pc after time what i insert in my label...but to don't use sleep() cuz if i use it i can close the gui:|

i don't get how....some ideas please

tnx

Share this post


Link to post
Share on other sites



how i can make it to shutdown pc after time what i insert in my label...but to don't use sleep() cuz if i use it i can close the gui:|

i don't get how....some ideas please

tnx

Several things wrong with what you're thinking:

1. You don't insert text into a label: Try the function GUICtrlCreateInput... examples are in the helpfile.

2. You're GUI won't close when you click exit unless you tell it to.

But, onto your problem...

Look at the Shutdown command in the helpfile, it should do what you want.


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Several things wrong with what you're thinking:

1. You don't insert text into a label: Try the function GUICtrlCreateInput... examples are in the helpfile.

2. You're GUI won't close when you click exit unless you tell it to.

But, onto your problem...

Look at the Shutdown command in the helpfile, it should do what you want.

i have make one but i have one err "Wend" statement with no matching "While" statement.

what i wrong on it???

#include <GUIConstants.au3>
Opt("TrayMenuMode",1)


$Menu1 = GUICreate("Shut Down Slut!!!", 328, 245, -1, -1)
GUISetState(@SW_HIDE)



$exittray = TrayCreateItem("Exit")
$abouttray = TrayCreateItem("About")
$1 = TrayCreateItem("")
$settings = TrayCreateItem("Settings")
$1 = TrayCreateItem("")
$start = TrayCreateItem("Strat")



$Group1 = GUICtrlCreateGroup("Settings", 48, 24, 233, 169)
GUICtrlSetColor(-1, 0xFF0000)

$text1 = GUICtrlCreateLabel("Time Set(h):", 72, 48, 61, 17, $SS_CENTERIMAGE)
$text2 = GUICtrlCreateLabel("Job Set:", 72, 80, 43, 17, $SS_CENTERIMAGE)

$ringcheck = GUICtrlCreateCheckbox("Ring", 72, 120, 97, 17)
$jobcheck = GUICtrlCreateCheckbox("Use Job", 72, 152, 97, 17)

$timeset = GUICtrlCreateCombo("", 136, 48, 113, 25)
GUICtrlSetData(-1, "1h|2h|3h|4h|5h")
$jubset = GUICtrlCreateCombo("", 136, 80, 113, 25)
GUICtrlSetData(-1, "Shutdown|Hibernate")


GUICtrlCreateGroup("", -99, -99, 1, 1)



While 1
    $Msg = GUIGetMsg()
    $tray = TrayGetMsg()
    If $msg= $GUI_EVENT_CLOSE Then
        GUISetState(@SW_HIDE,$Menu1)
    EndIf
        
    If $tray=$settings Then
        GUISetState(@SW_SHOW,$Menu1)
    EndIf
    If $tray=$exittray Then
        Exit
    EndIf
    If $tray=$start Then
        
        If $tray=$exittray Then
            Exit
        EndIf
        
            If GUICtrlRead($timeset)="1h" Then
                Sleep(3600000)
                    If GUICtrlRead($jubset)="Shutdown" Then
                            If GUICtrlRead($ringcheck) = 1 Then
                                Beep(5000,55000)
                                Sleep(60000)
                                Shutdown(9)
                            EndIf       
                                Shutdown(9)
                    ElseIf GUICtrlRead($jubset)="Hibernate" Then
                        Shutdown(64)
                    EndIf
            ElseIf GUICtrlRead($timeset)="2h"Then
                Sleep(7200000)
                    If GUICtrlRead($jubset)="Shutdown" Then
                            If GUICtrlRead($ringcheck) = 1 Then
                                Beep(5000,55000)
                                Sleep(60000)
                                Shutdown(9)
                            EndIf       
                                Shutdown(9)
                    ElseIf GUICtrlRead($jubset)="Hibernate" Then
                        Shutdown(64)
                    EndIf
            
            ElseIf GUICtrlRead($timeset)="3h"Then
                Sleep(10800000)
                    If GUICtrlRead($jubset)="Shutdown" Then
                            If GUICtrlRead($ringcheck) = 1 Then
                                Beep(5000,55000)
                                Sleep(60000)
                                Shutdown(9)
                            EndIf       
                                Shutdown(9)
                    ElseIf GUICtrlRead($jubset)="Hibernate" Then
                        Shutdown(64)
                    EndIf
            
            ElseIf GUICtrlRead($timeset)="5h"Then
                Sleep(18000000)
                    If GUICtrlRead($jubset)="Shutdown" Then
                            If GUICtrlRead($ringcheck) = 1 Then
                                Beep(5000,55000)
                                Sleep(60000)
                                Shutdown(9)
                            EndIf       
                                Shutdown(9)
                    ElseIf GUICtrlRead($jubset)="Hibernate" Then
                        Shutdown(64)
                    EndIf
            EndIf
WEnd

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

That happens because of all the other errors you have, fix them and the WEnd will work.

Edit: Also you should not use GUIConstants.au3, use GUIConstantsEx.au3 instead.

Edited by AdmiralAlkex

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  
Followers 0