MDL> weirdness with array values

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

MDL> weirdness with array values

Post by Me_again » Tue Jun 05, 2007 5:52 pm

Why can't I get MDL to display more than one array element?

Let>k=1
Let>q=2
Let>mystring[%k%]=first
Let>mystring[%q%]=second

//this works
MDL>mystring[%k%]

//this works
MDL>mystring[%q%]

//but this displays mystring[1] mystring[2]
MDL>mystring[%k%] mystring[%q%]

??

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

Post by JRL » Tue Jun 05, 2007 8:23 pm

My belief is that the incorrect portion of your script is that which you believe is working. Anytime/everytime I work with arrayed variables I set the arrayed variable to another benign variable before use.

Let>k=1
Let>q=2
Let>mystring[%k%]=first
Let>mystring[%q%]=second

Let>value_k=mystring[%k%]
MDL>%value_k%

Let>value_q=mystring[%q%]
MDL>%value_q%

MDL>%value_k% %value_q%

I'm not certain when using one arrayed variable in a message started to work (I'm fairly sure it didn't in past versions) but any extra text will cause it to fail. Put any character, even a space, on the same line with the "working" message line and it will fail.

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Jun 06, 2007 2:41 am

I don't see any logical reason why MDL> shouldn't work with array variables as it does with any other variable. Anyway, I put this in bugtracker so I hope we'll hear from Marcus. If this is the design behavior then maybe the help could be updated.

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

Post by JRL » Wed Jun 06, 2007 3:23 pm

I don't see any logical reason why MDL> shouldn't work with array variables as it does with any other variable.
I believe it does work with array variables exactly the same way it works with other variables.

Try this:

\\Your message will display "variable display"
Let>test=variable display
MDL>test

On the other hand if you add any other characters (a space for example), the variable buried in the text being sent to the message can no longer be deciphered so the message will display the word " test".

\\Your message will display " test"
Let>test=variable display
MDL> test

Of course if you want the value of the variable to be displayed, you can identify it as a variable by putting percents around it:

\\Your message will display "This is a test of message variable display"
Let>test=variable display
MDL>This is a test of message %test%


In the case of an arrayed variable, displaying the value requires percents around the sequential portion of the variable. As soon as you add other characters to the message text the program can no longer recognize what is plain text and what is an unpercented variable so the variable text is displayed rather than its value.

All that said. In my opinion the error, if there is an error, is allowing a variable's value to be displayed when it is alone in the message. It promotes discontinuity.

Hope this makes sense,
Dick

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Jun 06, 2007 3:43 pm

I agree, it's a bigger issue :cry:

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

Post by JRL » Wed Jun 06, 2007 4:31 pm

I'm not certain when using one arrayed variable in a message started to work (I'm fairly sure it didn't in past versions)
I just checked on version 8.0.4 and the line sample:

Let>test=variable display
MDL>test

Will display the word "test". So, as I suspected, this issue is new to version 9

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Wed Jun 06, 2007 9:45 pm

Greetings All,
JRL wrote:All that said. In my opinion the error, if there is an error, is allowing a variable's value to be displayed when it is alone in the message. It promotes discontinuity.
That behavior has always been by design, per the example below from the Help File:
  • Example

    MessageModal>Hello World!

    or with variables ..

    Let>mymsg=Hello World!
    MessageModal>mymsg
And further...
JRL wrote:I just checked on version 8.0.4 and the line sample:

Let>test=variable display
MDL>test

Will display the word "test". So, as I suspected, this issue is new to version 9
Then this must have been broken in version 8.0.4 because as per the Help File example, it should have displayed "variable display" i.e. the contents of the variable... not just "test".

Surely we'd want to keep this behavior the same for backward compatibility, old scripts must keep working.

Marcus, what do you make of all this?
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Wed Jun 06, 2007 10:07 pm

It depends on the content of the variable :wink:

Let>test=variable display
MDL>test

Returns "test" back to v7.something, but

Let>test=variabledisplay
MDL>test

Returns "variabledisplay"

As far as my testing goes, Message> has the same characteristics as MDL, so consider the Help example for arrays:

Let>Names[1]=Fred
Let>Names[2]=Sally
Let>Names[3]=Geoff
Let>k=2

Message>Names[%k%]

Returns "Sally".

To me that raises the expectation that there should be a way to use array variables in a message.

User avatar
jpuziano
Automation Wizard
Posts: 1085
Joined: Sat Oct 30, 2004 12:00 am

Post by jpuziano » Thu Jun 07, 2007 2:03 am

Me_again wrote:It depends on the content of the variable :wink:

Let>test=variable display
MDL>test

Returns "test" back to v7.something, but

Let>test=variabledisplay
MDL>test

Returns "variabledisplay"
That's weird. I just tested the following at ver 9.1.02:
  • Let>test=variable display
    MDL>test
...and thankfully "variable display" is what is displayed... like I would expect.

JRL says that under version 8.0.4 it will instead display just "test" and you say that behavior goes back to v7.something.

Could it be that in those older versions, the space inside the string of characters that makes up the contents of the variable: "test" is confusing the logic/parsing that goes on when the MDL> command is parsed? Perhaps this started happening when Complex Expressions were introduced?

In any case, it looks like this problem was found and fixed because it works like I would expect at 9.1.02. Marcus/Support, can you fill us in any further?
Me_again wrote: As far as my testing goes, Message> has the same characteristics as MDL, so consider the Help example for arrays:

Let>Names[1]=Fred
Let>Names[2]=Sally
Let>Names[3]=Geoff
Let>k=2

Message>Names[%k%]

Returns "Sally".

To me that raises the expectation that there should be a way to use array variables in a message.
Well sure, we can set array variables. I think its only natuaral to want to be able to display them directly... without having to use the trick of first creating a new variable, setting it's value equal to the array variable and then using that new variable to display the value of the array variable. :(

If this is not possible, then at least document the trick in the Help File so users will know how to do this. I have not personally searched the Help File so if this is mentioned in there, I apologize in advance... but if its not, I think it should be added.

Thanks Me_again and JRL for your research on this. Take care all.
jpuziano

Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post - :-)

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Thu Jun 07, 2007 2:42 am

Well this is strange because now I can't reproduce this:

Let>test=variable display
MDL>test

Returns "test" back to v7.something

:?

fightcancer
Macro Veteran
Posts: 239
Joined: Fri Apr 15, 2005 8:32 am

Re:

Post by fightcancer » Fri Apr 22, 2022 3:54 pm

jpuziano wrote:
Thu Jun 07, 2007 2:03 am
Me_again wrote: To me that raises the expectation that there should be a way to use array variables in a message.
Well sure, we can set array variables. I think its only natuaral to want to be able to display them directly... without having to use the trick of first creating a new variable, setting it's value equal to the array variable and then using that new variable to display the value of the array variable. :(
Is it possible in 2022? I can't figure out how to display array elements in a message. Example:

Code: Select all

ArrayDim>a,1
Let>k=1
Let>a_%k%=k
Msg>%a_k% = %k%

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

Re: MDL> weirdness with array values

Post by Dorian (MJT support) » Fri Apr 22, 2022 4:31 pm

Code: Select all

ArrayDim>a,1
Let>k=1
Let>a_%k%=k
Mdl>a_%k% = %k%
Yes, we have a Custom Scripting Service. Message me or go here

fightcancer
Macro Veteran
Posts: 239
Joined: Fri Apr 15, 2005 8:32 am

Re: MDL> weirdness with array values

Post by fightcancer » Fri Apr 22, 2022 4:38 pm

Dorian (MJT support) wrote:
Fri Apr 22, 2022 4:31 pm

Code: Select all

ArrayDim>a,1
Let>k=1
Let>a_%k%=k
Mdl>a_%k% = %k%
I was hoping to display the value of the array element (i.e. "1") rather than the name of the element (i.e. "a_1").

So the example above displays "a_1 = 1". Is there any way for MS to display "1 = 1" instead w/o using an extra line and var? Thanks!

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

Re: MDL> weirdness with array values

Post by Dorian (MJT support) » Fri Apr 22, 2022 4:52 pm

No, you need the extra line.
Yes, we have a Custom Scripting Service. Message me or go here

fightcancer
Macro Veteran
Posts: 239
Joined: Fri Apr 15, 2005 8:32 am

Re: MDL> weirdness with array values

Post by fightcancer » Fri Apr 22, 2022 5:01 pm

Thanks!

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