Jump to content
Sign in to follow this  
mikeylikesit

Timed Shutdown?

Recommended Posts

mikeylikesit

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?

Share this post


Link to post
Share on other sites
mikeylikesit

Awesome! thanks that was simple

now i know...


Hard work never killed anyone but why take the chance?

Share this post


Link to post
Share on other sites
Davo

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!!!

Share this post


Link to post
Share on other sites
Golbez

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.

Share this post


Link to post
Share on other sites
Gif

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+^j¢~â­jëh×6$timer = Guictrlcreateinput("" ,....................)
sleep (Guictrlread($timer)) 
shutdown (1)

use autoit quotes the next time.....

Share this post


Link to post
Share on other sites
Golbez

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+^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

Share this post


Link to post
Share on other sites
star2

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]

Share this post


Link to post
Share on other sites
sandin
mikeylikesit

wow thanks guys this is exactly what i was looking for awesome!


Hard work never killed anyone but why take the chance?

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  

×