Sign in to follow this  
Followers 0
Jon Mason

Time Count Down

3 posts in this topic

I'm pushing out an app that requires a reboot, but the installer does not do it on it's own. I want to give the user the chance to reboot on there own, but I'm going to nag them about it. Pardon my logic, but it works for me.

The only part I'm stuck on is the splash screen and the time count down. I don't know if this is stupid or not, but I wanted to throw this out to see what you all thought. I want the seconds to show as 2 digits instead of just 1 when it gets into the single digits. "09" instead of just "9"

$loop = 1
$answer1=MsgBox(4, $loop,"Reboot?")
if $answer1 = 6 then 
    _shutdown()
Else
    $loop = $loop + 1
EndIf


Do
    Sleep(1000)
    $answer2=MsgBox(4, $loop,"Reboot?")
    if $answer2 = 6 then 
        _shutdown()
    EndIf
    $loop = $loop + 1
Until $loop > 3

$timeMin = 4
$timeSec = 10

$timeLeft=500
do
SplashTextOn("Engineering", "Your PC will reboot in:" & @CR & $timeMin & ":" & $timeSec, 100, 50)
Sleep(1000)
$timeSec = $timeSec-1
if $timeSec < 0 Then
    $timeSec = 59
    $timeMin = $timeMin - 1
EndIf
Until $timeMin = 0

_shutdown()


Func _shutdown()
    MsgBox(0, "", "SHUTDOWN(2)")
;Shutdown(2)
    Exit
EndFunc

Share this post


Link to post
Share on other sites



You could use StringFormat also:

$Var2 = 8

$Replace = StringReplace(StringFormat('%2g', $Var2), ' ', 0)

MsgBox(0, 'Test2', $Replace)

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

8)

Perfect. Took a sec to figure out how to put that in my loop, but it works. Thanks!

Your an AutoIT :D

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  
Followers 0