Macro> command can't take a Let variable?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

rh2001
Newbie
Posts: 16
Joined: Tue Sep 14, 2004 9:48 am

Macro> command can't take a Let variable?

Post by rh2001 » Sun Sep 19, 2004 8:54 am

I have a somewhat long list of values and parameters to pass into another macro that I want to call using the Macro> command.

Thus, I want to use some concatenating and set this to a Let> variable and than pass that variable into the Macro> command

However, this Macro> command doesn't like unless it's direct and no variables.

Any help or news that this will be fixed in the future?

Thanks.

Lumumba

Post by Lumumba » Sun Sep 19, 2004 2:26 pm

[MyMainScript.scp]
Let>string = A
Let>string2 = ;B
Let>string3 = ;C
Let>string4 = ;D
Let>string5 = ;E

ConCat>string,%string2%
ConCat>string,%string3%
ConCat>string,%string4%
ConCat>string,%string5%

Macro>MyOtherScript.scp /string=%string%
[MyOtherScript.scp]
MessageModal>ConCatVar: %string%
Outcome should be:
ConCatVar: A;B;C;D;E

Btw: what about to use an INI file instead ?!

rh2001
Newbie
Posts: 16
Joined: Tue Sep 14, 2004 9:48 am

Nope, concat still doesn't work on the Macro> command

Post by rh2001 » Mon Sep 20, 2004 8:31 am

I tried Concat> and the methods you showed above.

Nevertheless, the error message reads like it's supposed to read, that is, the command with parameters, but it still says it, the macro, doesn't exist.

It seems like you can't use variables declared elsewhere for the Macro> command.


Any ideas why the Macro> command doens't like variables?

Lumumba

Post by Lumumba » Mon Sep 20, 2004 8:50 am

Macro>file_name [/variable=value|variable [/variable=value|variable] ... ]

Executes another script file. file_name must be a filename of a macro file. For macros that appear in Macro Scheduler's control panel, add '.scp' to the end of the macro name. It is also advisable to specify the full path should the path change during the execution of the calling macro.
Let>string = A
Let>string2 = ;B
Let>string3 = ;C
Let>string4 = ;D
Let>string5 = ;E

ConCat>string,%string2%
ConCat>string,%string3%
ConCat>string,%string4%
ConCat>string,%string5%

MessageModal>%string%

Macro>C:\MyPath\MyOtherScript.scp /string=%string%
:?:

rh2001
Newbie
Posts: 16
Joined: Tue Sep 14, 2004 9:48 am

Post by rh2001 » Tue Sep 21, 2004 5:17 am

Ok, It seems to be working now, thanks!!

rh2001
Newbie
Posts: 16
Joined: Tue Sep 14, 2004 9:48 am

SPOKE TOO SOON.....

Post by rh2001 » Mon Sep 27, 2004 11:26 pm

Seems like any parameter after the 1st parameter are not interpreted at variables.


Thus, strings 2, 3, 4, and so on are not even variables to begin with, even though declared correctly, and thus are not even passed as variables while though the 1st one is.

This parameter thing seems broken.

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 » Tue Sep 28, 2004 12:27 am

Just a reminder that the macro being called must already have the incoming variables declared, not just the first one.

And you will need format something like:
Macro>C:\MyPath\MyOtherScript.scp /string1=%string1% /string2=%string2% /string3=%string3%
Last edited by Bob Hansen on Wed Sep 29, 2004 4:12 pm, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

rh2001
Newbie
Posts: 16
Joined: Tue Sep 14, 2004 9:48 am

declare where?

Post by rh2001 » Wed Sep 29, 2004 11:25 am

Where should these variable be declared?

IF these variable are to declared inside the Macro being called, how will one be able to pass in new values to begin with as aren't the new values passed in at the very beginning of the script?

And if these variables are to be declared in the calling script, they don't seem to be working as I believe I tried it like you illustated before.

rh2001
Newbie
Posts: 16
Joined: Tue Sep 14, 2004 9:48 am

seems to be working now

Post by rh2001 » Wed Sep 29, 2004 11:47 am

Ok, I see what I was going wrong, seems to be ok now. Thanks.

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 » Wed Sep 29, 2004 8:47 pm

Do you think you could share your mistake so that others can benefit also?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

rh2001
Newbie
Posts: 16
Joined: Tue Sep 14, 2004 9:48 am

Post by rh2001 » Wed Sep 29, 2004 10:28 pm

having the same variable names as parameter name was the problem. There was a slight naming error that was causing this.

The example you gave string2, string3 wasn't all that clear. And I didn't know I had use the same names as Macro parameters.

Ethan

please, more clarification..

Post by Ethan » Wed Dec 01, 2004 10:03 pm

Hi, I know this thread is old, but I'm having the same problem.

rh2001, (or anybody else) were you able to pass multiple variables between macros successfully? Or did you concatenate ?

-Ethan

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 » Wed Dec 01, 2004 10:46 pm

An untested modification to my earlier response:

Contents of first script file:
Let>variable1=ValueForString1
Let>variable2=ValueForString2
Let>variable3=ValueForString3

Macro>C:\MyPath\MyOtherScript.scp /string1=%variable1% /string2=%variable2% /string3=%variable3%
In this case, the macro MyOtherScript.scp must already have the three variables string1, string2, and string3 in the script. Can do that at the begining of MyOtherScript.scp like this:
//The next three lines from my original posting are a bad example, would erase incoming values, as noted by support in subsequent message
//Let>string1=
//Let>string2=
//Let>string3=

//This next line should be OK. Was added as an edit after Support's catch.
MessageModal>First value coming in is %string1%.%CRLF%Second value coming in is %string2%.%CRLF%Third value coming in is %string3%.

//Do other stuff in the script.....
Thanks to Support for catching that......
Last edited by Bob Hansen on Wed Dec 01, 2004 11:24 pm, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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

Post by support » Wed Dec 01, 2004 11:04 pm

Bob,

Your example won't work because you are setting the values of the passed variables to nothing. So what you pass in is obliterated.

Macro>%SCRIPT_DIR%\othermacro.scp /var1=fred /var2=sally

othermacro.scp:
MessageModal>Hello %var1% and %var2%

You don't want to be reinitialising the passed variables at the start of the script or the values you pass in will be overwritten.
MJT Net Support
[email protected]

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 » Wed Dec 01, 2004 11:14 pm

You're right.....thanks for catching that.... a poor example of having them in the receiving script. That's what I get for working with too many languages at the same time.

The original example has been modifed.
Last edited by Bob Hansen on Wed Dec 01, 2004 11:25 pm, edited 1 time in total.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

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