ondrajka Posted May 2, 2009 Posted May 2, 2009 Here is my countdown timer that will also count up after it reaches zero. Was wondering how to do autoit math with remainders and non base 10 numbers. This was my test project just to see if it could be done. expandcollapse popup#include <Date.au3> $u=0; loop until $date = _DateAdd( 's',864015, _NowCalc()) $time = InputBox("Target Date", "Default 10 Days 15 Seconds" & @CRLF & "YYYY/MM/DD HH:MM:SS", $date) Do Sleep(1000) $td = _DateDiff('s', _NowCalc(), $time) $late = ""; dummy neg no If $td < 0 Then $late = "-"; dummy neg yes If $td < 0 Then $td = -$td; convert neg $td to pos for math $d = 0; Days with remainder math If $td > 86400 Then $dm = $td Do $dm = $dm - 86400 $d = $d + 1 Until $dm < 86400 EndIf $h = 0; Hours with remainder math If $td - ($d * 86400) > 3600 Then $hm = $td - ($d * 86400) Do $hm = $hm - 3600 $h = $h + 1 Until $hm < 3600 EndIf $m = 0; Miutes with remainder math If $td - ($d * 86400) - ($h * 3600) > 60 Then $mm = $td - ($d * 86400) - ($h * 3600) Do $mm = $mm - 60 $m = $m + 1 Until $mm < 60 EndIf $s = $td - ($d * 86400) - ($h * 3600) - ($m * 60); Seconds $db = ""; non zero for 2 digit numbers $hb = "" $mb = "" $sb = "" If $d < 10 Then $db = 0; zero for 1 digit number If $h < 10 Then $hb = 0 If $m < 10 Then $mb = 0 If $s < 10 Then $sb = 0 ToolTip("Target Date " & $time & @CRLF & "Time Left " & $late & $db & $d & ":" & $hb & $h & ":" & $mb & $m & ":" & $sb & $s, 10, 10) Until $u = 1
Yashied Posted May 3, 2009 Posted May 3, 2009 $time = InputBox("Target Date", "Default 10 Days 15 Seconds" & @CRLF & "YYYY/MM/DD HH:MM:SS", $date)What kind of accuracy! My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More...
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