06-19-2007, 02:51 PM
Functions can execute the same code as macros. You may need to insert spe -1 at the beginning to set the same speed as for macros.
If macro1 needs to execute macro2 and wait until macro2 returns, usually it is better if macro2 is function, and macro1 calls macro2 as function, like in this example:
macro2
or
macro2 argument1 argument2 ...
or
somevariable=macro2(argument1 argument2 ...)
When macro1 needs to launch macro2 and not wait for it, use mac:
mac "macro2"
At least one of them should be function, because two macros cannot run simultaneously. If both are macros, macro2 starts when macro1 ends.
If macro1 needs to launch macro2 in separate thread, it can use mac and wait. It is used rarely. Since mac returns thread handle, macro1 can wait for it:
wait 0 H mac("macro2")
Or can wait for some other event, eg global int variable (declared like int+ varname). Cannot wait for str variables, but when you modify a str variable, you can set an int variable to 1.
Using global variables to exchange values between macros is easy, but you should use unique variable names, for example g_whatitdoes, but not a or b.
If macro1 needs to execute macro2 and wait until macro2 returns, usually it is better if macro2 is function, and macro1 calls macro2 as function, like in this example:
macro2
or
macro2 argument1 argument2 ...
or
somevariable=macro2(argument1 argument2 ...)
When macro1 needs to launch macro2 and not wait for it, use mac:
mac "macro2"
At least one of them should be function, because two macros cannot run simultaneously. If both are macros, macro2 starts when macro1 ends.
If macro1 needs to launch macro2 in separate thread, it can use mac and wait. It is used rarely. Since mac returns thread handle, macro1 can wait for it:
wait 0 H mac("macro2")
Or can wait for some other event, eg global int variable (declared like int+ varname). Cannot wait for str variables, but when you modify a str variable, you can set an int variable to 1.
Using global variables to exchange values between macros is easy, but you should use unique variable names, for example g_whatitdoes, but not a or b.