t0ddie Posted January 14, 2006 Share Posted January 14, 2006 i just woke up and im thinking pretty slowly. i want to make a stopwatch. so it starts when the script starts and ends when the script closes. because timing may be off by just counting in an adlib function, i think the most accurate way is to get the system time at the start of the script and then get the time when it stops and determine the amount of time from those. but i cant think of how to code it at the moment my math part of my brain isnt awake yet any help? Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted January 14, 2006 Share Posted January 14, 2006 so ur saying u want something to record the time when u start a script then when it ends record, that time and then subtract them to see how many hours it ran? Link to comment Share on other sites More sharing options...
t0ddie Posted January 14, 2006 Author Share Posted January 14, 2006 (edited) something like that. but if the time when you start is 1 : 19 : 12 and the time when you end is 1 : 22 : 22 there will be a negative number. well i think i got it, just figure which is higher. then subtract from that for difference. man, i just woke up... musta been this bowl of cheerios that did it no wait... that might not give the proper time either damn it.. im still asleep! Edited January 14, 2006 by t0ddie Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. Link to comment Share on other sites More sharing options...
greenmachine Posted January 14, 2006 Share Posted January 14, 2006 Well, it should be the end time - the start time. So if those times above, 1:19:12 and 1:22:22, are the start and end times, the script should tell you that you've run it for 3:12. There's no negative number there.... Also, if you have times that are longer than 24 hours (or 12 hours on that kind of clock), then you need to take into account the what day it is and/or whether it is AM or PM. You should never get a negative number. Link to comment Share on other sites More sharing options...
Developers Jos Posted January 14, 2006 Developers Share Posted January 14, 2006 #include<date.au3> ; YourScript Sleep(12345) ; Func OnAutoItStart() Global $g_Timer = TimerInit() EndFunc ;==>OnAutoItStart Func OnAutoItExit() Local $Hour, $Mins, $Secs _TicksToTime(Int(TimerDiff($g_Timer)), $Hour, $Mins, $Secs) $Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs) MsgBox(0, "run time", $Time) EndFunc ;==>OnAutoItExit SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
t0ddie Posted January 14, 2006 Author Share Posted January 14, 2006 thanks jdeb Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you. 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