Skrip Posted December 22, 2005 Share Posted December 22, 2005 http://www.autoitscript.com/forum/index.php?showtopic=19347 (i'll repost script in a minute)so far I have the code from spook (thanks!) but I can't seem to get a GUI for it. I want a GUI with an input box to pop-up asking "What time do you want your computer to shut down at?" then have buttons Ok and Cancel. And what ever time I type in like 00:00:00 for midnight and 22:10:00 at 10:10 PM.While 1 $T3 = @hour & ":" & @Min & ":" & @sec If $T3 = "00" & ":" & "00" & ":" & "00" then shutdown(13) endif Sleep(50) WEndthats the shutdown code but I can't get the GUI explained above to work please help. [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
seandisanti Posted December 22, 2005 Share Posted December 22, 2005 http://www.autoitscript.com/forum/index.php?showtopic=19347 (i'll repost script in a minute) so far I have the code from spook (thanks!) but I can't seem to get a GUI for it. I want a GUI with an input box to pop-up asking "What time do you want your computer to shut down at?" then have buttons Ok and Cancel. And what ever time I type in like 00:00:00 for midnight and 22:10:00 at 10:10 PM. While 1 $T3 = @hour & ":" & @Min & ":" & @sec If $T3 = "00" & ":" & "00" & ":" & "00" then shutdown(13) endif Sleep(50) WEnd thats the shutdown code but I can't get the GUI explained above to work please help.well an inputbox() is different from a GUI. you should lookup InputBox() in the help file and you'll have your answer Link to comment Share on other sites More sharing options...
Skrip Posted December 22, 2005 Author Share Posted December 22, 2005 okay...well than I just need an input box, but I don't know how to have it tell the time i'm typing in... [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 22, 2005 Moderators Share Posted December 22, 2005 $Time2DoSomething = InputBox() That variable will hold whatever was typed in the input box, and you can pass it as such. A GUI is probably more efficient and professional looking IMHO, and... Koda can do that for you straight from the Tool section in SciTe Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Skrip Posted December 22, 2005 Author Share Posted December 22, 2005 okay , i'll try that but umm who's Koda? [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 22, 2005 Moderators Share Posted December 22, 2005 It's a very well put together tool that I believe 'LookFar' and 'LazyCat' put together (Forgive if I messed that up ). For people that don't know how, or want to learn how, or just like to do GUI's quickly, it's a 'Have to tool'. Open SciTe >> Tools >> Koda or Open SciTe and Alt+m Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Skrip Posted December 22, 2005 Author Share Posted December 22, 2005 2 things ------ Alright InputBox ("ShutDown Timer", "Please Enter the time to shutdown your computer using 24 hour clock.", "", "", -1, -1, 0, 0) While 1 $T3 = @hour & ":" & @Min & ":" & @sec If $T3 = "InputBox()" then shutdown(13) endif Sleep(50) WEnd that didn't work...I tried "16" & ":" & "37" & ":" & "00" then I moved my clock forward and tried 17 and that didn't work please help again. ------- ------- where is this SciTe? [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
Valuater Posted December 22, 2005 Share Posted December 22, 2005 maybe this you could "hide" the clock if you dont want to see it expandcollapse popup#include <GuiConstants.au3> $Alarm = InputBox ("ShutDown Timer", "Please Enter the time to shutdown your computer using a 12 hour clock.", "9:00:00 PM", "", -1, -1, 0, 0) Global $sec = @SEC, $minute, $hour, $light, $time, $clocklabel opt("WinWaitDelay", 100) opt("WinTitleMatchMode", 4) opt("WinDetectHiddenText", 1) opt("MouseCoordMode", 0) GUICreate("Max's Clock", 200, 50, (@DesktopWidth - 188) / 2, (@DesktopHeight - 59) / 2) $clocklabel = GUICtrlCreateLabel("Loading...", 5, 5, 190, 40, 0x1000) GUICtrlSetFont($clocklabel, 24) GUISetState() While 1 $msg = GUIGetMsg() If $msg = -3 Then ExitLoop ElseIf $sec <> @SEC Then GUICtrlSetData($clocklabel, TimeSet()) AlarmCheck(TimeSet()) EndIf WEnd Exit Func AlarmCheck($time) If $time = $Alarm Then MsgBox(0,"","Time to call it a night");Alarm function(configure how wanted) ;shutdown(13) EndIf EndFunc;==>AlarmCheck Func TimeSet() $light = " AM" $hour = @HOUR $minute = @MIN $sec = @SEC If $hour = 0 Then $hour = 12 ElseIf $hour = 12 Then $light = " PM" ElseIf $hour > 12 Then $hour = (@HOUR) - 12 $light = " PM" EndIf $time = $hour & ":" & $minute & ":" & $sec & $light Return $time EndFunc;==>TimeSet i commented-out the shutdown 8) Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 22, 2005 Moderators Share Posted December 22, 2005 That is a good one Val... but, I had just told him to put the InputBox() into a variable before he showed that code above yours... do you see his InputBox in a variable? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted December 22, 2005 Share Posted December 22, 2005 (edited) That is a good one Val... but, I had just told him to put the InputBox() into a variable before he showed that code above yours... do you see his InputBox in a variable?i noticed that he triedIf $T3 = "InputBox()" thenthat was an effort to put the variable in.... i guess8)EDITin retrospect... i noticed you were working with him and decided to stay out... and after he posted (2:42 pm) you didn't respond.... thats the only reason i stepped in...(3:11 PM) ( almost 1/2 hour (29 minutes))i was trying to respect you8) Edited December 22, 2005 by Valuater Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 22, 2005 Moderators Share Posted December 22, 2005 - Ooops I feel like an ass! - I didn't see that he 'litterally' followed my example!! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Skrip Posted December 22, 2005 Author Share Posted December 22, 2005 (edited) Sorry, I havn't used Autoit for a long time yet, I have made some pretty good scripts on my own, but like for this I had no clue on what to do. Thanks you very much Valuater! You have Helped me alot! So have you Smoke_N in other threads! Thanks everybody whos helped me. Edited December 22, 2005 by Firestorm [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
Skrip Posted December 23, 2005 Author Share Posted December 23, 2005 expandcollapse popup#include <GuiConstants.au3> $Alarm = InputBox ("ShutDown Timer", "Please Enter the time to shutdown your computer using a 12 hour clock.", "9:00:00 PM", "", -1, -1, 0, 0) Global $sec = @SEC, $minute, $hour, $light, $time, $clocklabel opt("WinWaitDelay", 100) opt("WinTitleMatchMode", 4) opt("WinDetectHiddenText", 1) opt("MouseCoordMode", 0) GUISetState() While 1 $msg = GUIGetMsg() If $msg = -3 Then ExitLoop ElseIf $sec <> @SEC Then GUICtrlSetData($clocklabel, TimeSet()) AlarmCheck(TimeSet()) EndIf WEnd Exit Func AlarmCheck($time) If $time = $Alarm Then $answer = MsgBox(3,"Shutdown","Shutdown Time arrived, continue? This box will select 'Yes' in 20 seconds if no selection.");Alarm function(configure how wanted) sleep(10) ControlSetText("Shutdown", "Cancel", "2", "Restart" ) ;if no then If $answer = 7 Then Exit EndIf ; if cancel then If $answer = 2 Then shutdown(6) Exit EndIf ;Function below if yes shutdown(13) EndIf EndFunc;==>AlarmCheck Func TimeSet() $light = " AM" $hour = @HOUR $minute = @MIN $sec = @SEC If $hour = 0 Then $hour = 12 ElseIf $hour = 12 Then $light = " PM" ElseIf $hour > 12 Then $hour = (@HOUR) - 12 $light = " PM" EndIf $time = $hour & ":" & $minute & ":" & $sec & $light Return $time EndFunc;==>TimeSet in that code at this part If $time = $Alarm Then $answer = MsgBox(3,"Shutdown","Shutdown Time arrived, continue? This box will select 'Yes' in 20 seconds if no selection.", 20);Alarm function(configure how wanted) sleep(10) ControlSetText("Shutdown", "Cancel", "2", "Restart" ) ;if no then If $answer = 7 Then Exit EndIf ; if cancel then If $answer = 2 Then shutdown(6) Exit EndIf Theres 2 problems at the cancel part I can't find the control # for cancel, and at ;if cancel then part it just shuts down the computer I want that to change to say Restart and for it to restart the computer. Please help. [left][sub]We're trapped in the belly of this horrible machine.[/sub][sup]And the machine is bleeding to death...[/sup][sup][/sup][/left] Link to comment Share on other sites More sharing options...
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