oic. thanks Steve! just a very minor inconvenience that I can live with seeing the power of MMM. I actually love to write smaller modular macros and pull them together with macro queue I suppose?? But not sure about parameter passing and flow control between the smaller macros... So I have never tried. Any insights there? Thanks a lot Steve!
Flow control can really only be handled separately in each running instance of MMM. It would be nice to be able to run several macro's at once from one master 'macro console' and have the flow control managed but MMM is not there yet. What I do now is modularize my routines within my macro using FOR RUN like this:
<macro line headers> 20 | FOR | EACH | LINE IN | D:\macro\checkstat.mmmacro | RUN <macro line body> 30 | FOR | EACH | LINE IN | D:\macro\redirect.mmmacro | RUN <macro line end> 50 | FOR | EACH | LINE IN | D:\macro\output.mmmacro | RUN
The FOR EACH LINE IN [file] RUN condition runs each macro line within the file. Effectively it's like calling a function or sub.
This is a great tip that I need Steve! Thanks again! However, I assume that when running checkstat.mmmacro, it has its new set of variables which is different from the main macro and these 2 sets of variables are not interchangeable. Am I right? Tks!
- main.mmmacro 1 | RUN ACTION | | | | DEFINE INTEGER VARIABLE | %INTEGER%::100 2 | FOR | EACH | LINE IN | D:\macro\checkstat.mmmacro | RUN 3 | RUN ACTION | | | | MESSAGE PROMPT | Value of Integer=%integer%::%integer%
Above main.mmmacro calls checkstat.mmmacro. checkstat.mmmacro just adds 10 to the value of %integer%.
When we run main.mmmacro first at line 1 we assign %integer% to 100, at line 2 run checkstat.mmmacro that adds +10 to %integer%, and at line 3 we show the result in a message prompt. The result is 110.
main.mmmacro carries the values of the variables because all the macro is handled by main.mmmacro. When the FOR RUN calls checkstat.mmmacro it is handled locally.