Calling a macro from a macro set

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Calling a macro from a macro set

H. Gluender
Dear experts,

how does one call a macro that is part of a macro set from another
macro of the same set -- or is this not yet possible?


Imagine for example:

//---------------- Macro Set in File: "StartupMacros.txt" -----------------

var myParam;

macro "macroA [a]" {

    for ( i = 0; i < 5; i++ ) {
       myParam = i;
       runMacro( ??? ); // <-- any idea of how to run macro "macroB [b]" ?
    }

}

macro "macroB [b]" {

    print( myParam );

}

//------------------------------------------------------------------------

Desired result in the "Log"-window:
0
1
3
4


Any idea of how to achieve this?


Best
--


                   Herbie

          ------------------------

          <http://www.gluender.de>
Reply | Threaded
Open this post in threaded view
|

Re: Calling a macro from a macro set

Wayne Rasband
> Dear experts,
>
> how does one call a macro that is part of a macro set from another
> macro of the same set -- or is this not yet possible?

Create a function that both macros call:

//---------------- Macro Set in File: "StartupMacros.txt"  
-----------------
   var myParam;

   macro "macroA [a]" {
      for ( i = 0; i < 5; i++ ) {
         myParam = i;
         myFunction();
      }
   }

   macro "macroB [b]" {
      myFunction();
   }

   function myFunction() {
      print( myParam );
   }

-wayne

> Imagine for example:
>
> //---------------- Macro Set in File: "StartupMacros.txt"  
> -----------------
>
> var myParam;
>
> macro "macroA [a]" {
>
>     for ( i = 0; i < 5; i++ ) {
>        myParam = i;
>        runMacro( ??? ); // <-- any idea of how to run macro "macroB  
> [b]" ?
>     }
>
> }
>
> macro "macroB [b]" {
>
>     print( myParam );
>
> }
>
> /
> /----------------------------------------------------------------------
> --
>
> Desired result in the "Log"-window:
> 0
> 1
> 3
> 4
>
>
> Any idea of how to achieve this?
>
>
> Best
> --
>
>
>                    Herbie
>
>           ------------------------
>
>           <http://www.gluender.de>