Hok Posted May 14, 2008 Posted May 14, 2008 Hey everyone, I made this shutdown timer and it doesn't seem to be working. expandcollapse popup#Region ### START Koda GUI section ### Form=c:\documents and settings\hdixon\desktop\autoit programming\koda\shutdown.kxf $Form1_1 = GUICreate("Form1", 378, 153, 194, 125) $Input1 = GUICtrlCreateInput("", 96, 8, 273, 21) $Label1 = GUICtrlCreateLabel("Shutdown Time", 0, 8, 78, 17) $Combo1 = GUICtrlCreateCombo("Shutdown", 96, 32, 273, 25) GUICtrlSetData(-1, "Hibernate") GUICtrlSetData(-1, "Restart") GUICtrlSetData(-1, "Standby") GUICtrlSetData(-1, "Close Conquer") $Label2 = GUICtrlCreateLabel("Shutdown Type", 0, 32, 79, 17) $Initiate = GUICtrlCreateButton("Initiate", 16, 88, 345, 57, 0) GUICtrlSetFont(-1, 24, 800, 0, "Greyhound") $Label3 = GUICtrlCreateLabel("Status", 0, 56, 70, 33) GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Initiate if guictrlread($combo1) = "Shutdown" then ShutdownC() EndIf if guictrlread($combo1) = "Restart" then Restart() EndIf if guictrlread($combo1) = "Standby" then Standby() EndIf if guictrlread($combo1) = "Close Conquer" then CloseCo() Endif if guictrlread($combo1) = "Hibernate" then Hibernate() Else MsgBox(0, "Shutdown Timer", "Please use one of the choices!") EndIf EndSwitch WEnd Func ShutdownC() $Time=GuiCtrlRead($Input1) $Label3 = GUICtrlCreateLabel("Status: Initiating Shutdown...", 0, 56, 70, 33) Sleep(Random(1000, 2000)) $Label3 = GUICtrlCreateLabel("Status: Shutdown Initiated.", 0, 56, 70, 33) Sleep($time*60*60) Shutdown(1) EndFunc Func Restart() $Time=GuiCtrlRead($Input1) $Label3 = GUICtrlCreateLabel("Status: Initiating Restart...", 0, 56, 70, 33) Sleep(Random(1000, 2000)) $Label3 = GUICtrlCreateLabel("Status: Restart Initiated.", 0, 56, 70, 33) Sleep($time*60*60) Shutdown(2) EndFunc Func Standby() $Time=GuiCtrlRead($Input1) $Label3 = GUICtrlCreateLabel("Status: Initiating Standby...", 0, 56, 70, 33) Sleep(Random(1000, 2000)) $Label3 = GUICtrlCreateLabel("Status: Standby Initiated.", 0, 56, 70, 33) Sleep($time*60*60) Shutdown(32) EndFunc Func Hibernate() $Time=GuiCtrlRead($Input1) $Label3 = GUICtrlCreateLabel("Status: Initiating Hibernate...", 0, 56, 70, 33) Sleep(Random(1000, 2000)) $Label3 = GUICtrlCreateLabel("Status: Hibernate Initiated.", 0, 56, 70, 33) Sleep($time*60*60) Shutdown(64) EndFunc Func CloseCo() $Time=GuiCtrlRead($Input1) Sleep($time*60*60) ProcessClose("[Conquer 2.0]") ProcessClose("[Conquer2.0]") EndFunc First of all- even though I did $time*60*60 to make it in Minutes, instead of MS... it doesn't seem to be working... Also, when I try to do the one that says Close Conquer it says "Please Choose One From The List"
PsaltyDS Posted May 14, 2008 Posted May 14, 2008 Hey everyone, I made this shutdown timer and it doesn't seem to be working. Func Hibernate() $Time=GuiCtrlRead($Input1) $Label3 = GUICtrlCreateLabel("Status: Initiating Hibernate...", 0, 56, 70, 33) Sleep(Random(1000, 2000)) $Label3 = GUICtrlCreateLabel("Status: Hibernate Initiated.", 0, 56, 70, 33) Sleep($time*60*60) Shutdown(64) EndFunc Func CloseCo() $Time=GuiCtrlRead($Input1) Sleep($time*60*60) ProcessClose("[Conquer 2.0]") ProcessClose("[Conquer2.0]") EndFunc First of all- even though I did $time*60*60 to make it in Minutes, instead of MS... it doesn't seem to be working... Also, when I try to do the one that says Close Conquer it says "Please Choose One From The List" Nothing in your script sets the $Input1 value, so it must be manual. What is entered there? Sleep() is timed in milliseconds, so how does $time*60*60 get you minutes? The input from $Input1 is a string. Don't assume the string to number conversion is always going to happed automatically, so use this to get the number: $time = Number(GuiCtrlRead($Input1)) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now