You have to login in order to post a reply to this topic.

2 replies [Last post]
Andrew
Andrew's picture
User offline. Last seen 1 year 25 weeks ago. Offline
Joined: 03/12/2010
Posts: 33

When I run a job from outside the debugger, it displays box containing the information "Running for: (time)".  It would be useful to have an action that accesses the runtime of the current job and stores it in a variable, so I can keep a log of how long a job took. (Maybe this already exists and I just don't know how to do it.)

Also, it would be useful if the "Run Job" action had a "with command line arguments" option so I wouldn't have to either use external variables or call WinAutomationController using the "Run DOS Command" action.

Thomas Minitsios
User offline. Last seen 1 year 4 weeks ago. Offline
Joined: 07/16/2009
Posts: 34
Re: Get Job Runtime

Hello Andrew,

Regarding the "Get Job Runtime":

You can do this by using the following 3 simple actions:

- The first action of your job should be a "Get Current Date and Time" action. Let's assume that you save this in a variable %StartDateAndTime%

- At the point where you want to retrieve the job execution time, you will have to place another "Get Current Date and Time" action and store it in a variable named %CurrentDateAndTime% for example

- Then, use the "Subtract Dates" action to get the difference between the %StartDateAndTime% and %CurrentDateAndTime% variables in days, hours, minutes or seconds
 

Regarding the command line arguments in the "Run Job" action:

The recommended way of passing values between jobs is through the external variables. This is the main usage of the external variables and the reason that they were built for. I cannot see any cases that the usage of external variables will not be sufficient and you would definitely have to use command line arguments. As a matter of fact, the external variables give you the option of passing variables with their types while the command line arguments would only allow you to send text to the child job.

Andrew
Andrew's picture
User offline. Last seen 1 year 25 weeks ago. Offline
Joined: 03/12/2010
Posts: 33
Re: Get Job Runtime

I figured out that I could use subtract dates shortly after posting.  Still, it took some extra work to calculate the difference in dates in hours, minutes, and seconds.

External variables work well--the advantage of command line arguments is that they work more like function parameters in C or Java.  Of course I can get a similar functionality by adding "Set Variable" actions at the beginning of my program such as: "Set Variable" %NewVariableName% = %ext:OriginalVariableName%.  I didn't realize that command line arguments are only stored as text variables--I wonder if they could easily be redesigned to perform a "Set Variable" action automatically.