Calculation problem

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Torkas
Newbie
Posts: 10
Joined: Wed Sep 30, 2015 5:41 pm

Calculation problem

Post by Torkas » Wed Oct 23, 2019 4:04 pm

Hi again,

I have detected a problem with the FORMAT command. If I use the FORMAT command in a operation loop like the example, the RAM memory increases 100k every second and in few hours the script ends crashing due to excess of RAM memory. In a normal operation without the FORMAT command the script is stable and continue "forever" without problems:

Let>a=1.34
Let>n=1
Label>INIT
Let>b=4.3%n%
Format>%.2n,{(%a%-%b%)},result
Message>%result%
Let>n=%n%+1
Goto>INIT

Does anybody know why ?

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

Re: Calculation problem

Post by Dorian (MJT support) » Thu Oct 24, 2019 11:00 am

I tried your code and didn't experience any performance issues, so it's difficult to test, but there are two things I might try.

#1. I'm wondering if your use of n as a variable is interfering with the n in format. Format still seems to be working though, so this may be a red herring. See if this is better.

Code: Select all

Let>a=1.34
Let>n=1
Label>INIT
Let>b=4.3%n%
Format>%.2n,{(%a%-%b%)},result
Message>%result%
Let>n=%n%+1
Wait>0.05
Goto>INIT
#2. It could simply be a tight loop. Let's see if adding a tiny wait improves things.

Code: Select all

Let>a=1.34
Let>z=1
Label>INIT
Let>b=4.3%z%
Format>%.2n,{(%a%-%b%)},result
Message>%result%
Let>z=%z%+1
Goto>INIT
It is odd that it only does that if Format is included though. I'm also wondering if b eventually becoming incredibly long might be playing in to this. Please let us know how you get on.
Yes, we have a Custom Scripting Service. Message me or go here

Torkas
Newbie
Posts: 10
Joined: Wed Sep 30, 2015 5:41 pm

Re: Calculation problem

Post by Torkas » Thu Oct 24, 2019 5:48 pm

Hi again Dorian,

I need to execute the script without "Wait>". The problem doesn't depend of the increase of "n", it occurs in a loop without increase of "n" value too. If you check the [Task_Manager] you can see this increase of RAM memory in the "msched.exe" process [More or Less, +100k every second]. If instead of use the FORMAT command you use the "FormatNumber" command of [VBA], the RAM memory is stable and It doesn't increase.

Let>a=1.34
Let>n=1
Label>INIT
Let>b=4.3%n%
VBEval>FormatNumber(%a%-%b%),result
Message>%result%
Let>n=%n%+1
Goto>INIT

This combination using "VBEval>FormatNumber" works correctly and the RAM memory is stable.

Thanks equally for your answer !!! :D

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

Re: Calculation problem

Post by Dorian (MJT support) » Fri Oct 25, 2019 2:14 pm

I see exactly what you mean. Thank you for bringing this to our attention. We've added it to the list of things for dev to look at.
Yes, we have a Custom Scripting Service. Message me or go here

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