Calculate End Time from Gettime>

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Calculate End Time from Gettime>

Post by Esabik » Wed Jan 05, 2022 3:30 pm

Hi

I am using an excel with my script to do bulk transactions in our MRP system. So if the excel has 697 records to transact and with each loop it takes 15 seconds for each record to process. This would be a total of 10,455 seconds or approx 174 minutes. After my script cycles a record the remaining seconds drops by 15 and the minutes remaining are calculated as well going down in time.

What I am trying to do is add the minutes remaining to come up with an EndTime. Trying to add the minutes(minremain) to the Gettime> function.

//this code does not work
Gettime>now
Let>minremain=174
Let>Endtime=%now%+%minremain%
MDL>Endtime
//My error Looks like this 9:52:33 AM+174

So I need to clean up the time and remove the seconds but add minutes to the Now variable so the shows me the future End Time based on the minutes remaining. It is also possible to have almost 1000 records so the minutes remaining might be close to 250 minutes that I need to add the Now..... for the Endtime

Can this be done? Please any ideas? Is there a sample of similar code?
Just when you thought it was safe to go in the water........:evil:

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Calculate End Time from Gettime>

Post by Dorian (MJT support) » Wed Jan 05, 2022 4:01 pm

There you go :

Code: Select all

Gettime>now
Let>minremain=174
TimeAdd>%now%,M,%minremain%,EndTime
MDL>Endtime
Some links for you :
Date/Time Commands
TimeAdd
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Re: Calculate End Time from Gettime>

Post by Esabik » Wed Jan 05, 2022 5:28 pm

Dorian (MJT support) wrote:
Wed Jan 05, 2022 4:01 pm
There you go :

Code: Select all

Gettime>now
Let>minremain=174
TimeAdd>%now%,M,%minremain%,EndTime
MDL>Endtime
Some links for you :
Date/Time Commands
TimeAdd
Ah interesting. Shorter than I thought but, it is not working for me. So the machine I use scripting is offline because its an older os(win7) that has network vulnerabilities and it is Macro version 12.1.10
I see this is a v15 manual. Do you recall what version the (TimeAdd) command was added?

With the newer OS(win10) etc... there are security timeouts that can't be shut off from IT and running scripts do not seem to be acknowledged by the system so the screen locks and messes up the script.

Additional note is that I can't "thank you guys" enough for all the quick support you provide. It really helps us alot since coding sometimes takes forever to get something working with so many different systems and variables.
Just when you thought it was safe to go in the water........:evil:

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Calculate End Time from Gettime>

Post by Dorian (MJT support) » Wed Jan 05, 2022 6:20 pm

From the Version History page it looks like TimeAdd was added in 2011 in v13. Your version is over a decade old and no longer supported.
Yes, we have a Custom Scripting Service. Message me or go here

User avatar
Esabik
Pro Scripter
Posts: 52
Joined: Wed Jun 15, 2005 8:03 pm
Location: Fairfield, NJ

Re: Calculate End Time from Gettime>

Post by Esabik » Wed Jan 05, 2022 8:00 pm

Dorian (MJT support) wrote:
Wed Jan 05, 2022 6:20 pm
From the Version History page it looks like TimeAdd was added in 2011 in v13. Your version is over a decade old and no longer supported.
Oh yes, I've found that I had the newer version downloaded, just never upgraded that version on the PC. :cry:

Thank you!!! :mrgreen:
Just when you thought it was safe to go in the water........:evil:

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Calculate End Time from Gettime>

Post by Dorian (MJT support) » Wed Jan 05, 2022 8:33 pm

Excellent news!
Yes, we have a Custom Scripting Service. Message me or go here

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