Jump to content
Sign in to follow this  
lopolop

Script not working

Recommended Posts

lopolop

can anyone tell me a better way to keep a timer.. basicaly i want to shutdown my computer after the given time is up

For some reason this did not work..

$time=10800000 ;3 Hours... i think
$i=0
while $i < $time
    $i=$i+1
    ToolTip($i, 10, 10)
    sleep(1000)
WEnd
Shutdown(1)
Edited by lopolop

Share this post


Link to post
Share on other sites
BrettF

So by what I can see, you want the computer to shut down in 3 hours right? Try this:

#include <Date.au3>
$cTime1 = _NowTime (5)
$ctime = StringSplit ($cTime1, ":")
$eTime = $cTime[1] + 3 & ":"& $ctime[2] &":"&$ctime[3]
MsgBox (0, "", "Alarm Set: " & $ctime1 & @CRLF & "Alam Will Go Off At: " & $eTime)

While 1
    If _NowTime (5) = $eTime Then
        MsgBox (0, "Alarm!", "The Times up!")
    EndIf
WEnd

Share this post


Link to post
Share on other sites
improbability_paradox

Personally, I would do it with TimerInit() and TimerDiff()

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.