Macro Toolworks Products Discussion Forums :: General Discussion
Welcome Guest   
 Subject :calculate seconds.. 09-12-2010 23:35:10 
hugblue@hotmail.com
Joined: 13-10-2010 01:09:07
Posts: 100
Location: sweden
i have tried to see if it was possible.

i want to calculate the amount of seconds between to point in my program.
so i know how much time it is using from time to time.

i wrote this. but its wrong.
so need some help.

heres the code :

<varset>("vTimeSpan=EXPR(%__vCurrTime_Second_ForCalc%-2005.11.21 13:45:00)","")<varset>("counter=1","")<label>("start")<var_oper>(counter,"%counter%+1",CALC_EXPRESSION,"0","", "0")<if>("counter>=5000")<goto>("get_out")<endif><goto>("start")<label>("end")<label>("get_out")<varset>("vTimeSpan2=EXPR(%__vCurrTime_Second_ForCalc%-2005.11.21 13:45:00)","")<msg>(100,100,"%vTimeSpan%
%vTimeSpan2%","Message",1,0,0)

- - -

hugblue
IP Logged
 Subject :Re:calculate seconds.. 15-12-2010 11:32:46 
petr
Joined: 15-10-2009 11:48:52
Posts: 152
Location
Hello,

I would suggest you to use "_vCurrTime_Total" system variables. It contains number of milliseconds elapsed from computer reboot. So you can store value this variable in one point of your macro to other variable and do the same in other point and then subtract the two values and divide 1000 and you get number of seconds elapsed between the two points.
IP Logged
 Subject :Re:calculate seconds.. 15-12-2010 19:53:52 
hugblue@hotmail.com
Joined: 13-10-2010 01:09:07
Posts: 100
Location: sweden
hi petr.

can u please come with a programming example.
i have tried to use that. with no luck.

thz.
IP Logged
 Subject :Re:calculate seconds.. 17-12-2010 19:52:07 
petr
Joined: 15-10-2009 11:48:52
Posts: 152
Location
Hello,

here is the example:

<cmds>

<#> Milliseconds measure start point
<varset>("vMSStart=_vCurrTime_Total","")

<#> Do some thing...

<msg>(-100,-100,"Close this message window.","Message",1,0,0)

<#> Milliseconds measure end point
<varset>("vMSEnd=_vCurrTime_Total","")

<#> Calculate seconds
<var_oper>(vSecondsElapsed,"(%vMSEnd%-%vMSStart%)/1000",CALC_EXPRESSION,"2","", "0")

<#> Show seconds elapsed
<msg>(-100,-100,"The message window was opened for %vSecondsElapsed% seconds.","Message",1,0,0)
IP Logged
Last Edited On: 17-12-2010 19:52:36 By petr for the Reason
 Subject :Re:calculate seconds.. 24-04-2011 12:34:45 
azarij@gmail.com
Joined: 24-04-2011 10:15:50
Posts: 1
Location
Hi All,

I know the topic is kinda old. However, just wanted to develop the idea and need your advice guys.
Is it possible to trigger a macro by let's say holding middle mouse button pressed for let's say 3 seconds? if yes, how will it look in code?
i tried to adapt the above code, but to no success.

thank you.
IP Logged
Page # 


Powered by ccBoard


Login and share your experience - send messages to forums and add comments to samples, commands and other resources.



Account is free of charge, easy to setup.