I just started experimenting with QM and it looks very useful. I made a simple macro that calls three other macros sequentially and repeats 100 times. It seems to work fine except that sometimes I would like to be able to stop it before it completes all 100 iterations but a haven't been able to figure out how. Any help would be appreciated.
rep 100
mac "macro1"
mac "macro2"
mac "macro3"
Thanks.
Posts: 12,073
Threads: 140
Joined: Dec 2002
There are two different things in QM:
1. Run macro. The mac command starts new macro which runs asynchronously. If the macro actually is function, your code will start 300 simultaneously running threads (a thread is a running macro or function that is launched by the user or by the mac command). If the macro actually is macro, most instances simply will not start, because QM does not allow more than one macro run at a time.
2. Call function. When you call a function, the caller macro waits until the function ends. That is, the function runs synchronously, in the same thread. Only items of type function can be called as functions.
I think you should use the second way. If macro1 etc are not functions, go to Properties and convert them to functions. Modify the code.
rep 100
macro1
macro2
macro3
When you convert a macro to a function, consider inserting the spe command at the beginning of the function, or it may run too fast because the initial autodelay for functions is 0:
spe -2
Now how to stop a macro before it ends itself. If the main macro is macro, press Pause (you can change this hotkey in Options). If it is function, use the Threads dialog: menu Tools -> Threads, or tray menu -> End function.