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
Can I pass an Array Variable to a Macro?
Moderators: JRL, Dorian (MJT support)
Can I pass an Array Variable to a Macro?
"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
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.
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!
Bob
A humble man and PROUD of it!
I don't get it....
Bob,
Thanks for the reply. You wrote:
Can you give me an example of how I might make passing arrays work?
Tx,
George
Thanks for the reply. You wrote:
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?The destination macro must already have the variables defined before accepting input from passed macro.
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
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.
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]
[email protected]