This macro gives a different result......

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
User avatar
PepsiHog
Automation Wizard
Posts: 511
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

This macro gives a different result......

Post by PepsiHog » Thu Sep 20, 2018 10:05 pm

Hello Everyone,

I have MS12 the latest version and MS14 the current version. I was writing (still am) a macro. Below is an excerpt from said macro. I get different results between the two versions of MS. In version 12 my macro works as expected. In MS14 I get an error. Which I tracked down to being the sample script provided here. In other words this is the problem.

What the error is, is in version 12 IndexCardData keeps it's value even after the separate command. In version 14, for some reason, it does not keep it's value. It turns into an empty string. But before Separate it has the expected value.

I'm sorry, maybe I shouldn't refer to it as an error just yet, but for lack of a better word.

The error is easily fixed. Add one line of code and presto. But one line of code doesn't answer if it's just my computer, if the change was intentional, or the reason behind the change.

As you have likely figured out, this is a Marcus question more so than anyone else. But maybe if you try it, you might get a different result and be able to post it.

Ok, Marcus, here's the code.

Code: Select all

LabelToVar>IndexCard_Data,IndexCardData

mdl>%IndexCardData%

Separate>IndexCardData,;,IndexCardData
mdl>%IndexCardData%

/*
IndexCard_Data:
4337;4611;5108;4395;3419;2395;7050;2657;3880;4476;4454;3084;2307;3772;4090;4575;3874;3458;1922;6475;2178;3371;3955;4876;3476;2681;3608;3873;4352;3657;2717;1729;6231;1982;3160;3738;4198;2933;2075;3301;4403;4894;4187;3765;2211;6815;2470;3678;4268;4692;3307;2521;
*/
Probably obvious, but you have to have both versions of MS and you have to run it in both versions.

Captain Obvious
a.k.a
PepsiHog
.............and Thanks!
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: This macro gives a different result......

Post by Marcus Tettmar » Thu Sep 27, 2018 4:02 pm

Not sure what you're expecting but you are using the same variable name for the result as the input and the result is an array. V12 didn't have array types. It would have produced new basic variables IndexCardData_1 ... IndexCardData_n.. So IndexCardData stayed as it was. But with v14 it becomes an array. Just a change. For the better. Enjoy.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
PepsiHog
Automation Wizard
Posts: 511
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: This macro gives a different result......

Post by PepsiHog » Thu Sep 27, 2018 9:39 pm

@Marcus,

Please try it yourself. I started working on this macro years ago. In MS12 it works. I assure you, that is not the issue. It assigns it to an array_n, but the original value never changes. Use MS12, do the same as I have done. Then check the value of the original string. It's the same with RegEx. The original string wasn't changed, but the arrays were created. Now they are changed to empty strings in 14. (Both RegEx and Separate)

I have both installed (12 and 14) In 12 my macro works, in 14 it does not.
(The part that this applies to, works. There is another reason why I am trying to move it to 14.)

I will do as you suggest in 14. I will change the name.

Ok. I changed it to :

Separate>IndexCardData,Misfit

IndexCardData is changed to an empty string. Is that the intent? If so, why destroy a value?

Thanks,
PepsiHog
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
PepsiHog
Automation Wizard
Posts: 511
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: This macro gives a different result......

Post by PepsiHog » Thu Sep 27, 2018 10:36 pm

Ok. I re-read your post. It seems you are saying it is intentional. I can't say I understand. You have always made it downward compatible. If the programmer wanted it an empty string, why not leave that up to the programmer?

On a lighter note, what is the "better" about this change?

Now I have to re-write my macro. More program lines to accomplish the same result. ( Not stated with bad attitude, just fact.)

PepsiHog.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: This macro gives a different result......

Post by Marcus Tettmar » Fri Sep 28, 2018 5:59 pm

Occasionally there are breaking changes. We try to avoid that but we also don't always envisage what people will do. We've created proper arrays. These functions return an array. Real arrays let us do more with them and allow for array functions. It is my opinion that this is a beneficial change.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

User avatar
PepsiHog
Automation Wizard
Posts: 511
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: This macro gives a different result......

Post by PepsiHog » Sat Sep 29, 2018 3:51 pm

Marcus,
I understand what you are saying. I expect nothing less from you. Please show me an example. Please help me figure this out. I changed the names to be different, same result. Please show me what to do, so I understand what I am doing wrong.

PepsiHog

Anyone that sees the error in my ways in my script please show me. I would like to see a working example.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

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