How to Run a macro in another macro?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
blcjm
Posts: 2
Joined: Sun May 04, 2003 8:19 am

How to Run a macro in another macro?

Post by blcjm »

Hi,
Since We can not edit the macros, so I split a complex macro into some small micro to advoid mistakes, then join them:
I record some macros, for example:
macro01,macro02,macro03......
and next I want to record another Macro using these macros,
for example containing these steps:
......
execute macro01
execute macro02
execute macro03
......
but when finish it, I find it cann't run as I think.
Textpad help files say that "Previously recorded, named macros are Recordable Commands"
Can you help me?
Thanks!
User avatar
Bob Hansen
Posts: 1517
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Here are two ways to do this:

A.
1. Record and save each macro:
1_Macro01
2_Macro02
3_Macro03
2. Record another macro that executes the macros from the Menu by typing ALT-M, and then using the arrow keys to select the macro and execute it. Repeat calling each macro in this manner. Save the combined macro (4_Combined Macro04).
3. Remove (Do not Delete) Macros 01,02,03 from the list of macros in the Configure window, so the only macro showinig is the combined macro.

B.
1. Record Macro03 first and save it.
2. Record Macro02 and for its last step execute Macro02 as noted above. Save Macro02.
3. Record Macro01 and for its last step execute Macro02 as noted above. Save Macro01.
3. Remove (Do not Delete) Macros 02,03 from the list of macros in the Configure window, so the only macro showinig is Macro01.

A few more notes:
!. Option A is probably better. Since you cannot edit macros option B will always call the Macros built into themselves. Option A allows you to just replace the combined Macro vs. having to change the imbedded macros also.

2. When recording a macro calling another macro, what is recorded is the relative position on the Menu list, not the macro name. So it is important to control the position of macros on that list. I have found that it is best to assign a unique number/letter as the first character in the macro name (1_Macro01, 3_Macro03, 4_Combined Macro04, etc.). After pressing ALT-M to call the macro list, pressing the number will automatically go to that macro no matter where it is listed in the sequence. The other option is to try maintaining positions using the Move Up/Down controls in the Configure Macro window, but that is too much work and relies on our faulty memories.

3. You can test this out by making some simple test macros like entering a single text line:
"This is macro1", or "This is line 2", etc. and then saving and combining them. It is easier to do this with single lines before you record you non-editable macro for real.

Hope this helps, good luck.
Hope this was helpful.............good luck,
Bob
blcjm
Posts: 2
Joined: Sun May 04, 2003 8:19 am

Post by blcjm »

Thank you very much!
Guest

Post by Guest »

> When recording a macro calling another macro, what is
> recorded is the relative position on the Menu list, not
> the macro name. So it is important to control the
> position of macros on that list.


No, when you record a macro calling another macro, the contents of the macro being played are copied into the macro being recorded.
There's no reference whatsoever to the original macro and the position in the menu makes no difference.

Berend
User avatar
Bob Hansen
Posts: 1517
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

:oops:I was sure that in the past I have had a macro(#1) call another macro(#2) and got wrong results when the position of macro #2 changed, but perhaps I was wrong.

:? But now I see that it may be possible that my problem was a result of your other comments re how you believe that it works:

:arrow: Following up on your comments that when macro#1 calls macro#2 that the contents of macro#2 is imbedded into macro#1: This is something that needs to be clearly understood by all macro users..

Because if that's the way it works, then if I modify macro#2 (actually have to record again with no editor), then the next time I run macro #1, it is going to do what the original macro#2 called out, not the current macro#2!

Which means any macro(#2) called by another macro(#1), cannot be changed without requiring a change in the calling macro(#1) also! Imagine the problem with multiple levels of nested macros :!:

:idea: Once again.....we need to be able to edit macros!:idea: :arrow:

Thanks for your clarification.
Hope this was helpful.............good luck,
Bob
User avatar
jeffy
Posts: 323
Joined: Mon Mar 03, 2003 9:04 am
Location: Philadelphia

Post by jeffy »

Anonymous wrote:No, when you record a macro calling another macro, the contents of the macro being played are copied into the macro being recorded.
This is exactly right.
Post Reply