Can I pass an Array Variable to a Macro?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

Can I pass an Array Variable to a Macro?

Post by mightycpa » Mon Jan 19, 2004 9:06 pm

Hi,

Let's say I do this:

Let>Array_Var[1]=this
Let>Array_Var[2]=that
Let>Array_Var[3]=the other
Let>Array_Var[4]=more

Can I pass the array to another macro, or must I pass each array element to the macro?

I tried

Macro>Script.scp /AV=Array_Var[] and various permutations of that with no luck.

On the receiving end, so far, I've just got:

Let>k=1
Repeat>k
MessageModal>av[%k%]
Let>k=k+1
Until>k,5


Tx,

George
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Jan 19, 2004 10:57 pm

1. The destination macro must already have the variables defined before accepting input from passed macro.

2. I found that creating an INI file works better and allows me to only update variables once, and write them to INI file. But all called macros can use the values without passing values each time. Works real good for nested macro routines. Each macro just reads the INI file for the values it needs.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

mightycpa
Automation Wizard
Posts: 343
Joined: Mon Jan 12, 2004 4:07 pm
Location: Vienna, VA

I don't get it....

Post by mightycpa » Mon Jan 19, 2004 11:12 pm

Bob,

Thanks for the reply. You wrote:
The destination macro must already have the variables defined before accepting input from passed macro.
Which I take to mean that one would use Let>av[n]=something...in the destination macro. But doesn't that defeat the purpose of the value being passed?

Can you give me an example of how I might make passing arrays work?

Tx,

George
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Jan 20, 2004 11:40 pm

Hi,

Unfortunately at present you cannot pass entire arrays from one macro to another. But you could pass one element of the array to a standard variable:

Macro>MacroA /VarA=MyArray[2]

or

Macro>MacroA /VarA=MyArray[%k%]

And then in MacroA you would refer to VarA like you would any standard variable. If you wish to pass an entire array you could perhaps convert it to a delimited list, pass it and then explode back to an array with the Separate command.

We are looking to improve on this in future versions.
MJT Net Support
[email protected]

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