AutoHotkey Community

It is currently May 26th, 2012, 2:05 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: January 13th, 2009, 12:16 pm 
Offline

Joined: January 13th, 2009, 12:15 pm
Posts: 3
Hi everybody,

i am trying to get a time subtraction running, but i somehow seem to bee a dau when i read through the help file.

Basically, i just want a timer that tells me how long my script ran. Heres what i got:

1. FormatTime, var1, T12, Time
2. Outputdebug The current time is %var1%.
3. EnvSub, timestring, %var1%, m
4. Outputdebug, Wir haben %timestring% gespielt.

My thinking process:
Line 1: set the variable var1 in the T12 time format and get the aktuell time
Line 2: tells me in debugfenster the time
Line 3: subtract timestring (set at script start) from var1
Line 4: tell me the difference in T12 time format

Unfortunately i get:
[6576] The current time is 12:10:43. <---- %timestring%
[6576] The current time is 12:10:48. <---- %var1%
[6576] Wir haben gespielt. <---- where is the time difference?


Can someone please help me and tell me where my thoughts are wrong? Probabaly just a format error, but i aint sure.

Thanks in advance for the help!

P.s. Sorry for the double post. Admin please delete the guest post ;)
[ Moderator!: Sure! Deleted it ]


Last edited by JimBeam_de on January 14th, 2009, 9:57 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 12:34 pm 
Code:
StartTime := A_TickCount
Sleep, 1000
ElapsedTime := A_TickCount - StartTime
MsgBox,  %ElapsedTime% milliseconds have elapsed.


of course, it displays in mil-seconds, so if u want seconds, u divide by 1000, if want mins, divide 60 more


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 13th, 2009, 12:37 pm 
No useful help can be given because you have not posted your code. An outline is of no use when trying to debug code.

All I can say given your post is a quote from the help file:
Quote:
EnvSub - TimeUnits
If present, this parameter directs the command to subtract Value from Var as though both of them are date-time stamps in the YYYYMMDDHH24MISS format.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2009, 9:56 pm 
Offline

Joined: January 13th, 2009, 12:15 pm
Posts: 3
Anonymous wrote:
No useful help can be given because you have not posted your code. An outline is of no use when trying to debug code.

All I can say given your post is a quote from the help file:
Quote:
EnvSub - TimeUnits
If present, this parameter directs the command to subtract Value from Var as though both of them are date-time stamps in the YYYYMMDDHH24MISS format.


Sorry for the mis understanding. That is my code, i just put numbers in front of every line here in the post so that i could explain what i was thinking...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 14th, 2009, 9:57 pm 
Offline

Joined: January 13th, 2009, 12:15 pm
Posts: 3
evan wrote:
Code:
StartTime := A_TickCount
Sleep, 1000
ElapsedTime := A_TickCount - StartTime
MsgBox,  %ElapsedTime% milliseconds have elapsed.


of course, it displays in mil-seconds, so if u want seconds, u divide by 1000, if want mins, divide 60 more


Thanks Tons Evan!!!! With that what you gave me i was able to tie it in just how i needed! Aweseome Forum and Awesome Support!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 4:55 am 
Offline

Joined: September 5th, 2008, 3:34 am
Posts: 44
but doesnt the values shows in 8-bits format?
is there any way to make it show just up to 2 decimal places for seconds.
cause my timer is just a few seconds only.
like 1.83 seconds?

is this possible?

_________________
I have lost friends, some by death... others through sheer inability to cross the street.
Virginia Woolf (1882 - 1941),

(\__/) This is Bunny.
(='.'=) Cut, copy, and paste bunny onto your sig.
(")_(") Help Bunny gain World Domination.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 16th, 2009, 5:34 am 
deportivo5 wrote:
but doesnt the values shows in 8-bits format?
is there any way to make it show just up to 2 decimal places for seconds.
cause my timer is just a few seconds only.
like 1.83 seconds?

is this possible?
Code:
StartTime := A_TickCount
Sleep, 1000
ElapsedTime := (A_TickCount - StartTime) / 1000
Rounded := Round(ElapsedTime,2)
MsgBox,  %ElapsedTime% milliseconds have elapsed. Rounded is %Rounded%


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Exabot [Bot], LazyMan, poserpro, Tilter_of_Windmills and 10 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group