ShutDown Timer

« Older   Newer »
  Share  
-Coyote-
icon2  CAT_IMG Posted on 3/8/2010, 10:16     +1   -1




Il titolo dice tutto :P Siccome nessuno ha postato questo tipo di programma ho pensato di postarlo io. Solo che c'e' un piccolo ma fastidioso problema... Il tempo bisogna inserirlo in millisecondi :P
SPOILER (click to view)
#include <buttonconstants.au3>
#include <editconstants.au3>
#include <guiconstantsex.au3>
#include <staticconstants.au3>
#include <windowsconstants.au3>
#Region ### START Koda GUI section ### Form=
$ShutDownTm = GUICreate("ShutDown Timer", 362, 247, 234, 250)
$ShutDown = GUICtrlCreateButton("ShutDown", 24, 120, 89, 33)
$Restart = GUICtrlCreateButton("Restart", 136, 120, 89, 33)
$LogOff = GUICtrlCreateButton("LogOff", 256, 120, 89, 33)
$Hibernate = GUICtrlCreateButton("Hibernate", 72, 168, 89, 33)
$Standby = GUICtrlCreateButton("Standby", 192, 168, 89, 33)
$Functions = GUICtrlCreateGroup("Functions", 8, 104, 345, 105)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group1 = GUICtrlCreateGroup("Timer", 24, 24, 305, 57)
$Input1 = GUICtrlCreateInput("", 48, 48, 257, 21)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Write = GUICtrlCreateLabel("Write Time in MS", 104, 0, 189, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ShutDown
$ShutDownTimer = GUICtrlRead ($Input1)
MsgBox (0, "Shutdown", "Timer Started!")
Sleep ($ShutDownTimer)
Shutdown (1)
Case $Restart
$RestartTimer = GUICtrlRead ($Input1)
MsgBox (0, "Restart", "Timer Started!")
Sleep ($RestartTimer)
Shutdown (2)
Case $LogOff
$LogOffTimer = GUICtrlRead ($Input1)
MsgBox (0, "LogOff", "Timer Started!")
Sleep ($LogOffTimer)
Shutdown (0)
Case $Hibernate
$HibernateTimer = GUICtrlRead ($Input1)
MsgBox (0, "Hibernate", "Timer Started!")
Sleep ($HibernateTimer)
Shutdown (64)
Case $Standby
$StandbyTimer = GUICtrlRead ($Input1)
MsgBox (0, "Standby", "Timer Started!")
Sleep ($StandbyTimer)
Shutdown (32)
EndSwitch
WEnd

 
Top
ACIDBURN16
CAT_IMG Posted on 3/8/2010, 10:29     +1   -1




Puoi fare anche se se scrivi "1" in un input con un if riporta il tempo in millesecondi.
tipo così:
CODICE
$IF=(GuiCtrlRead($Input))
         if $IF="1" Then
                  sleep(1000)
endif
 
Top
-Coyote-
CAT_IMG Posted on 3/8/2010, 10:39     +1   -1




ma se faccio cosi non e' che devo fare un IF per ogni numero e combinazione di numeri esistenti? xF
 
Top
SuperAntani
CAT_IMG Posted on 3/8/2010, 15:32     +1   -1




non conviene fare:
CODICE
$read = GUICtrlRead ($input)
Sleep ($read & "000")

?
 
Top
Lahace
CAT_IMG Posted on 3/8/2010, 20:12     +1   -1




CITAZIONE (SuperAntani @ 3/8/2010, 16:32)
non conviene fare:
CODICE
$read = GUICtrlRead ($input)
Sleep ($read & "000")

?

ma no! se non glielo dicevi presentava la prossima versione con qualche migliaio di if

:asd:
 
Top
-Coyote-
CAT_IMG Posted on 3/8/2010, 20:45     +1   -1




Lahace, non e' affatto divertente xD XD. Comunque avevo gia iniziato a fare gli IF xD Ero arrivato solo a 532 :P
 
Top
xMasteRx
CAT_IMG Posted on 3/8/2010, 22:40     +1   -1




bah a farlo cosi facevi prima facendo addiritura un to ... for ... next XD
 
Top
Kn0t
CAT_IMG Posted on 3/8/2010, 22:43     +1   -1




Moltiplicazione
CODICE
$read = GUICtrlRead ($input)
$time = $read * 1000
sleep($time)

;D
 
Top
ACIDBURN16
CAT_IMG Posted on 4/8/2010, 07:12     +1   -1




CITAZIONE (-Coyote- @ 3/8/2010, 21:45)
Lahace, non e' affatto divertente xD XD. Comunque avevo gia iniziato a fare gli IF xD Ero arrivato solo a 532 :P

Già, pensavo dovessi mettere massimo 10 secondi xD, cmq puoi fare anche :
CODICE
If GUICtrlRead($ora) = @HOUR And GUICtrlRead($minuti) = @MIN And GUICtrlRead($SEC) = @SEC Then
è parte all'ora prestabilita.
 
Top
~•~†Søap˜M.T.™†~•~
CAT_IMG Posted on 4/8/2010, 12:47     +1   -1




lol ! QUella Degli If Mi è piaciuta lool !
 
Top
9 replies since 3/8/2010, 10:16   164 views
  Share