Sending information up to parent macro
Moderators: JRL, Dorian (MJT support)
Sending information up to parent macro
I am using Msched 5.10. I have a shell macro that calls another macro to do some porcessing. I pass it variables to be operated on. Works fine. I want to take a value from the called macro and pass it back up to the parent shell macro. The information pass seems to operate only down - not up.
I realize that 7.1 supports true subroutines - can this be done in 5.10?
Snippet of Shell Macro:
.
.
.
Let>CELL4=0
Macro>SpiderRun /CSVNUM=%T4% /CELL=%CELL4%
.
The SpiderRun (child) macro does some processing and changes the value of CELL. I want that info back in the parent.
Thanks
Dave
I realize that 7.1 supports true subroutines - can this be done in 5.10?
Snippet of Shell Macro:
.
.
.
Let>CELL4=0
Macro>SpiderRun /CSVNUM=%T4% /CELL=%CELL4%
.
The SpiderRun (child) macro does some processing and changes the value of CELL. I want that info back in the parent.
Thanks
Dave
Hi,
With that version the only workaround would be to store the value that you want passed back in an INI file, text file or in the Registry. I'd use a small INI file in your macro directory:
[macroname]
settingname=value
Then use EditIniFile in the called macro to save the value and ReadIniFile in the calling macro to read the value after it has called the macro.
With that version the only workaround would be to store the value that you want passed back in an INI file, text file or in the Registry. I'd use a small INI file in your macro directory:
[macroname]
settingname=value
Then use EditIniFile in the called macro to save the value and ReadIniFile in the calling macro to read the value after it has called the macro.
MJT Net Support
[email protected]
[email protected]
Another alternative
So I am guessing an upgrade to 7.1 is a better fix. Are all my 5.10 scripts going to run without problem?
If so, how do I upgrade - download and pay upgrade fee pay first and get link with download file address?
Thanks
Dave
P.S. - your great product keeps going strong. I am glad it is working out!
If so, how do I upgrade - download and pay upgrade fee pay first and get link with download file address?
Thanks
Dave
P.S. - your great product keeps going strong. I am glad it is working out!
Hi,
7.1 will let you create subroutines. However, you still can't return values from called macros with the Macro> command.
The only change is that you now have to specify the full filename in the Macro> command - you can't just specify a macro name.
Otherwise all your scripts will still run - everything else is backward compatible.
You can order the upgrade at http://www.mjtnet.com/sales.htm ($23.98 for the Standard version which now includes VBScript).
Just install over the top of your existing version selecting the minimal install option to keep your scripts and settings intact. Or install into a different directory if you want to keep the old version, and copy the scripts over.
7.1 will let you create subroutines. However, you still can't return values from called macros with the Macro> command.
The only change is that you now have to specify the full filename in the Macro> command - you can't just specify a macro name.
Otherwise all your scripts will still run - everything else is backward compatible.
You can order the upgrade at http://www.mjtnet.com/sales.htm ($23.98 for the Standard version which now includes VBScript).
Just install over the top of your existing version selecting the minimal install option to keep your scripts and settings intact. Or install into a different directory if you want to keep the old version, and copy the scripts over.
MJT Net Support
[email protected]
[email protected]
Reply to Lumumba - I like your idea - I'll have to think how I can use it in my app - may be just the ticket.
Reply to Marcus - Two things:
1) If I can't get the information up to the parent macro via the Macro command - Is there some other, better subroutine command which will work or am I still going to need to use one of the creative mechanisms such as clipboard or ini file?
2) Regarding upgrade to 7.1 standard - if someday down the road I need the compiler version will I be able to further upgrade for the cost difference?
Thanks to both of you
Dave
Reply to Marcus - Two things:
1) If I can't get the information up to the parent macro via the Macro command - Is there some other, better subroutine command which will work or am I still going to need to use one of the creative mechanisms such as clipboard or ini file?
2) Regarding upgrade to 7.1 standard - if someday down the road I need the compiler version will I be able to further upgrade for the cost difference?
Thanks to both of you
Dave
1. Unless you want your "sub macros" to be able to be run independently then use subroutines and the Gosub command.
2. Yes, you can upgrade to the Pro version with compiler at any time.
2. Yes, you can upgrade to the Pro version with compiler at any time.
MJT Net Support
[email protected]
[email protected]
Yes, subroutines are routines within the same macro so you can set a variable that the entire script can see. Subroutines can be branched to with Gosub and return to the point at which they were called.
See the Gosub help topic in the online help at http://www.mjtnet.com/support.htm
e.g.
Gosub>SubroutineA
Message>SubAReturnVal
etc
SRT>SubroutineA
..
..
Let>SubAReturnVal=Something
END>SubroutineA
See the Gosub help topic in the online help at http://www.mjtnet.com/support.htm
e.g.
Gosub>SubroutineA
Message>SubAReturnVal
etc
SRT>SubroutineA
..
..
Let>SubAReturnVal=Something
END>SubroutineA
MJT Net Support
[email protected]
[email protected]