|
Post by Piranja on Nov 3, 2020 16:21:00 GMT
Hello fine people!
I have a MMM macro that runs continuously (in loop). Now I want it to loop for 4 minutes, pause/wait for 70 seconds, and then start/resume loop again for 4 minutes, pause/wait 70 seconds, and so on.
Is this even possible? And if so, how do I do it?
Thanks. Piranja
|
|
|
Post by zeak on Nov 8, 2020 23:53:13 GMT
Hi Piranja, I believe what you are chasing is the Wait command, On you macro list Right click and select, Add Condition, then select Run Action dot point, in the Action drop down list select the wait you wish to use.
|
|
|
Post by Steve on Nov 10, 2020 7:19:31 GMT
Hi Piranja,
MMM executes each macro line one at a time synchronously. To evaluate the current time has to be done by an external application and caught with MMM or on a single macro line.
Consider this example:
1 | RUN ACTION | DEFINE INTEGER VARIABLE | %INTEGER4%::4 * | LOOP_START 2 | RUN ACTION | WAIT SECONDS | 2 3 | RUN ACTION | MESSAGE PROMPT | %time_macro%::::1 4 | IF | STRING VARIABLE | %TIME_MACRO% | STARTS WITH | %INTEGER4%: | MESSAGE PROMPT | Check success::::2 5 | IF | STRING VARIABLE | %TIME_MACRO% | STARTS WITH | %INTEGER4%: | DEFINE INTEGER VARIABLE | %INTEGER4%::+4 | AND | 5 | RUN ACTION | WAIT SECONDS | 70 6 | RUN ACTION | GOTO MACRO LINE | LOOP_START
This macro evaluates the total macro running time at line 4 and 5. MMM holds the current macro running time in a variable %time_macro% but at the moment evaluating the running time is not pretty. At line 4 we check if the running time starts with '4:' indicating 4 minutes have passed. This works if we can evaluate the macro during the 4th minute. At line 5 we evaluate the running time again, increment the counter by 4 (%integer4%) and wait 70 seconds before returning to the start of the loop (LOOP_START).
Effectively we are looping for 4 minutes, pause and waiting for 70 seconds, and then resuming the loop.
|
|