Time Calculation in MessageBox

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
kriemer
Pro Scripter
Posts: 57
Joined: Fri Oct 30, 2009 2:59 pm

Time Calculation in MessageBox

Post by kriemer » Sun Mar 20, 2011 4:32 pm

I use the following partial code

Code: Select all

//Set RunTime in Hours
  Let>RuntimeHr=0.03
  Let>RunTimeMin=RunTimeHr*60
  Let>RunTimeSec=RunTimeMin*60
//Time Calculation & Screen Message Box - All Attempts
  VBEval>DateAdd("m",%RunTimeHr%,now),LoopEndTime
  Let>MSG_STAYONTOP=1
  Message>Loop Run Time: %RunTimeHr% Hour(s) / %RunTimeMin% Min(s) %CRLF%Loop Completion: %LoopEndTime%
This message part of the code works so long as the RunTimeHr is an integer. When the value is not an integer the %LoopEndTime% value does not calculate.

Any ideas where I've gone wrong? (I could send the entire scripts if this snippet does not provide enough information.

k

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Mon Mar 21, 2011 3:51 am

I believe that DateAdd only uses whole numbers. So the logical thing to do would be to use the calculated seconds.

VBEval>DateAdd("s", %RunTimeSec%, now),LoopEndTime

kriemer
Pro Scripter
Posts: 57
Joined: Fri Oct 30, 2009 2:59 pm

Post by kriemer » Mon Mar 21, 2011 9:56 am

So simple, once you know; so hard to know.

Thanks for the answer this was really starting to bug me.

k

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts