mikeylikesit Posted May 18, 2007 Share Posted May 18, 2007 Hi All, I am new to auto it and i love it! I Ike to make backups each night at my work. (i burn them to CDS) the problem is my boss gets mad at me when i leave the computer on. I was looking for a way to shut down the computer after a time i set. This is what i have $timer = InputBox("Shutdown", "When would you like to shutdown?") sleep ("$timer") shutdown (1) I think something is wrong with the sleep ("$timer") but i do not know how else to do it. Can someone just point me in the right direction? Thanks Hard work never killed anyone but why take the chance? Link to comment Share on other sites More sharing options...
mikeylikesit Posted May 18, 2007 Author Share Posted May 18, 2007 Awesome! thanks that was simple now i know... Hard work never killed anyone but why take the chance? Link to comment Share on other sites More sharing options...
Davo Posted May 18, 2007 Share Posted May 18, 2007 Oops I was trying to edit the post and I accidently deleted it lol, doing too many thingd at once For anyone interested the fix was to change: sleep("$timer") to sleep($timer) Since a variable should not be send to a function as a string Dave PS if you want a bit of code to make your program allow you to enter the time u want the computer to shut down consider looking at the macros @HOUR, @MIN, @SEC. if you need the method let me know ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------"I don't need to know everything, I just need to know where to find it when I need it"....EinsteinAnd in our case... That's the AutoIT helpfile ;) Please read before posting!!! Link to comment Share on other sites More sharing options...
Golbez Posted May 18, 2007 Share Posted May 18, 2007 wtf are you looking for? a program to stop at a certian time??? (the @hour gos on a 24 hour time clock) $htime = 12 $mtime = 45 if $htime = @hour and $mtime = @min then exit this will close a program if it is 12:45 pm. Link to comment Share on other sites More sharing options...
Gif Posted May 18, 2007 Share Posted May 18, 2007 Since a variable should not be send to a function as a string you cannot use "" to a variable , without declaring it so.. $timer = InputBox("Shutdown", "When would you like to shutdown?") sleep ($timer) shutdown (1)oÝ÷ Ù©l¢'ò¢ì(ºWeGç²'«Êjw+y«^j¢~âjëh×6$timer = Guictrlcreateinput("" ,....................) sleep (Guictrlread($timer)) shutdown (1) use autoit quotes the next time..... Link to comment Share on other sites More sharing options...
Golbez Posted May 19, 2007 Share Posted May 19, 2007 you cannot use "" to a variable , without declaring it so.. $timer = InputBox("Shutdown", "When would you like to shutdown?") sleep ($timer) shutdown (1)oÝ÷ Ù©l¢'ò¢ì(ºWeGç²'«Êjw+y«^j¢~âjëh×6$timer = Guictrlcreateinput("" ,....................) sleep (Guictrlread($timer)) shutdown (1) use autoit quotes the next time..... if i wanted to spoon feed him i would have.. i was just given him an example of how it could be done Link to comment Share on other sites More sharing options...
star2 Posted May 19, 2007 Share Posted May 19, 2007 check this out #include <GUIConstants.au3> $main = GUICreate ("example",130,60) GUICtrlCreateLabel ("Please enter time",10,7) $time = GUICtrlCreateInput ("",10,30,50) $ok = GUICtrlCreateButton ("Sleep",65,30,50,20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $ok Then GUISetState (@SW_HIDE , $main) MsgBox(-1,"info","Shutdown after "&GUICtrlRead ($time)&" second") Sleep (GUICtrlRead ($time)*1000) Shutdown (1) EndIf WEnd [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
sandin Posted May 19, 2007 Share Posted May 19, 2007 I made a prog. with this option, maybie u'll like it: Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
mikeylikesit Posted May 19, 2007 Author Share Posted May 19, 2007 wow thanks guys this is exactly what i was looking for awesome! Hard work never killed anyone but why take the chance? 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