Jmtyra Posted July 17, 2005 Posted July 17, 2005 (edited) I'm still learning AutoIt myself, but this took me a bit and I hope I can save someone else the headache. Guess you could use it as a function and pass it the time as an argument if you'd like. Enjoy! Note: Should work ok, I ran a few 'tests' with different numbers and it seemed to work ok. expandcollapse popup; timelimit is in seconds $Timelimit = 130 $Timeleft = $Timelimit Do ; if we've got more then 60s & less then 120s, then it's only 1 whole min left + sec(s) If $Timeleft > 60 And $Timeleft < 120 Then ; if it's a whole min, no sec If Int($Timeleft/60) = $Timeleft/60 Then ProgressOn("", "Installer Time Left...", Int($Timeleft/60) & " Minute", -1, -1, 1) ; if it's got trailing sec, *still* single whole min left Else ; if we've got single case sec If ($Timeleft - (Int($Timeleft/60) * 60)) <= 1 Then ProgressOn("", "Installer Time Left...", Int($Timeleft/60) & " Minute " & ($Timeleft - (Int($Timeleft/60) * 60)) & " Second", -1, -1, 1) ; or plural sec(s) Else ProgressOn("", "Installer Time Left...", Int($Timeleft/60) & " Minute " & ($Timeleft - (Int($Timeleft/60) * 60)) & " Seconds", -1, -1, 1) EndIf EndIf ; if we've got more then 1 whole min ElseIf $Timeleft > 60 Then ; checking for whole min only, no sec... If Int($Timeleft/60) = $Timeleft/60 Then ProgressOn("", "Installer Time Left...", Int($Timeleft/60) & " Minutes", -1, -1, 1) ; if we have multiple min & sec Else ; if we've got single case sec If ($Timeleft - (Int($Timeleft/60) * 60)) <= 1 Then ProgressOn("", "Installer Time Left...", Int($Timeleft/60) & " Minutes " & ($Timeleft - (Int($Timeleft/60) * 60)) & " Second", -1, -1, 1) ; or plural sec(s) Else ProgressOn("", "Installer Time Left...", Int($Timeleft/60) & " Minutes " & ($Timeleft - (Int($Timeleft/60) * 60)) & " Seconds", -1, -1, 1) EndIf EndIf ; if we've got less then 1 min, only sec left + we can just use the var now Else If $Timeleft <= 1 Then ProgressOn("", "Installer Time Left...", $Timeleft & " Second", -1, -1, 1) Else ProgressOn("", "Installer Time Left...", $Timeleft & " Seconds", -1, -1, 1) EndIf EndIf ProgressSet(($Timeleft / $Timelimit) * 100) Sleep(1000) $Timeleft = $Timeleft - 1 Until $Timeleft < 0 PS - I left the notes for logic flow Edited July 17, 2005 by Jmtyra
Jmtyra Posted July 17, 2005 Author Posted July 17, 2005 haha you misspelt 'grammatically'<{POST_SNAPBACK}> Eh, oh well...
saveriuccio Posted February 7, 2009 Posted February 7, 2009 Great job! It would be possible add a "pause" button? And maybe some action (open file...) when countdown is finished? Thanks! Sa
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