If you're going to do that, you have to use a semaphore to keep the first macro from exiting before the second one has completed. Mach provides no synchronization between macros at all.
For example:
M1000.m1s:
Code "M01 ("This is M1000")
M2000.m1s:
Code "M1000"
Code "M01 ("This is M2000")
If you execute M2000, it will queue up the M1000 macro, then proceed executing. So what you'll see is:
"This is M2000"
"This is M1000"
Which is exactly opposite what you want and expect.
Here's what you need to do:
M1000.m1s:
SemaphoreVar = 1000 ' This can be any unused Var number - Must be same one as in M2000.m1s
Code "M01 ("This is M1000")
SetVar (SemaphoreVar, 0)
M2000.m1s:
Code "M1000"
SemaphoreVar = 1000 ' This can be any unused Var number - Must be same one as in M1000.m1s
SemaphoreVal = 1
SetVar (SemaphoreVar, SemaphoreVal)
Code "M01 ("This is M1000")
While SemaphoreVal > 0
SemaphoreVal = GetVar(SemaphoreVar)
Sleep 10
Wend
Code "M01 ("This is M2000")
The semaphore ensures that the M1000 macro completes execution *before* the M2000 macro progresses beyond the While/Wend loop. You can actually nest macros several deep if you initialize the semaphore to zero in the top-most macro, then have the calling macro increment the semaphore value, and make the While condition wait for it to be decremented back to its original value, and have the called macro decrement the semaphore, instead of simply clearing it. This is the only way I know of to make nested macros behave in a predictable manner. Without this, you have no way of knowing the exact order in which they'll execute, so it will behave differently at different times. This is another of the MANY things that will be fixed in v4.
Regards,
Ray L.