Mesca Posted November 23, 2009 Share Posted November 23, 2009 I want to include in one of my scripts something that shows how long the script has been running, a stopwatch of sorts. I've been looking at examples but all seem very complicated. I am looking for a simple script that shows hours/minutes/seconds. I am a noob, so is there anyone out there who can help me compile a script like this or even better just post it up? Thanks in advance. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 23, 2009 Moderators Share Posted November 23, 2009 (edited) mesca,If you are looking at a relatively short period, look at TimerInit and TimerDiff - that will get you a value which a bit of basic maths will transform into hours, minutes and seconds. _TicksToTime might help you with the calculating.If you are looking to measure considerably longer perods, then _DateDiff and _NowCalc will do much the same thing. You will definitely need the basic maths though. Have a go yourself and come back if you run into problems. M23Edit: Clarity and added _TicksToTime. Edited November 23, 2009 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Mr5o1 Posted November 23, 2009 Share Posted November 23, 2009 (edited) #include <Date.au3> Local $miliseconds, $hours, $mins, $secs $miliseconds = TimerInit() Sleep(1000) ;your script goes here..... $miliseconds = TimerDiff($miliseconds) _TicksToTime($miliseconds, $hours, $mins, $secs) ConsoleWrite(@CRLF & $hours & ":" & $mins & ":" & $secs) this should get you started! doh... you beat me to it melba! Edited November 23, 2009 by Mr5o1 Link to comment Share on other sites More sharing options...
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