Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running Different Versions of Macro Depending on previous
#1
Hi,
I actually think I solved this one myself, but thought there might be a more elegant or stable solution:

I have two menus off of a toolbar each with several macro choices (Lets say 1, 2, or 3 in the first menu and A, B, C in the second menu

The catch is that the macro that is launched from the second menu must depend on the choice from the first menu (i.e. the second set of choices act upon the result of 1, 2 or 3 and therefore must reflect that choice

i.e. If 2 was chosen first from the first menu, then choosing A, B, or C will run macro A2, B2, or C2 respectively. BUT if 3 was chosen from the first menu, then choosing A, B, or C will run macros A3, B3, or C3, respectively.

I have solved this by placing a global variable (int+ a) in the first macros (1, 2, 3) setting that variable to 1, 2, or 3 depending on which one was chosen.
Then if A is chosen, it's macro text looks like this:

Code:
Copy      Help
if a=1; mac "A1"
if launchcode=2; mac "A2"
if launchcode=3; mac "A3"
if launchcode=0; ret

Etc, same for choices B (B1, B2, or B3 macros) and C (C1, C2, or C3 macros) respectively.

Should I be doing this through some function or some other more efficient method?
If I get this to work, is there any reason I shouldn't have done it this way?
Sorry if my description was confusing!

Stuart
#2
Your description is clear, as always. The shorter way is

if(a<1 or a>3) ret
mac _s.from("A" a)


Forum Jump:


Users browsing this thread: 1 Guest(s)