Jump to content
Macro Express Forums

Macro Needs To Recognize If It Was Called By Anoth


Machtyn
 Share

Recommended Posts

Here's my situation: I have two macros. Macro "A" performs certain functions and can be run by itself, if necessary. Macro "B" will call Macro "A" at a certain point. I want Macro "A" to perform certain lines but ignore certain other lines if it was called by Macro "B". Is this possible with a simple command (similar to If Macro Enabled/Disabled).

 

I've thought to assign a variable in Macro "B" and have Macro "A" check it, but I'd prefer to keep away from using too many vars.

 

What follows is a pseudocode example of what I'm talking about.

 

Run Macro B
Macro B: process stuff
Macro B: call Macro A

     Macro A:  process stuff
     Macro A:  If not called by Macro B
     Macro A:     do stuff
     Macro A:  end if
     Macro A:  do more stuff
     Macro A:  if called by Macro B
     Macro A:     return to Macro B
     Macro A:  display dialogue showing end of macro

Macro B:  process stuff
Macro B: display dialogue showing end of macro

Thanks,

Machtyn

Link to comment
Share on other sites

Hi, Machtyn. Welcome to the group.

 

The only way I see this happening is... like you said.. set a variable in Macro B and set your If statements in Macro A (if varaible = macro b, then run commands). If you are concerned about using too many variables... just before you set the variable, do a variable save command. Set the variable, run macro A, and at the point it comes back to Macro B, do a variable restore. This way, you are not using up any variables.

Link to comment
Share on other sites

Great! Thanks for the help. I did like I mentioned (set a var) and it works proper. I'm not using a whole lot of variables, so it's really only a concern of keeping variables straight in my head (that's what comments are for, though, right ;) )

 

Macro B: set %T99% to "Macro B"

  Macro A: if %T99% = "Macro B"
  Macro A:     do stuff (such as return to Macro B)
  Macro A: do other stuff
  Macro A: if %T99% <> "Macro B"
  Macro A:     do stuff, like display end of macro dialogue

Link to comment
Share on other sites

  • 4 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...