This can be done using the following 3 macros:
Start Loop Macro
m := @Prompt([OKCANCELEDIT]; "Loop"; "Enter number of times to loop"; ""); n := @Text(@TextToNumber(m) - 1); @SetEnvironment("LoopMax"; n); @SetEnvironment("LoopCnt"; "0"); @Command([ToolsRunMacro]; "Ping")
cnt := @TextToNumber(@Environment("LoopCnt")); max := @TextToNumber(@Environment("LoopMax")); @If(cnt > max; @Return(""); "");REM "Now do all the fancy processing stuff you want to do";
@Set("cnt"; cnt + 1); @SetEnvironment("LoopCnt"; @Text(cnt)); @Command([ToolsRunMacro]; "Pong");
@Command([ToolsRunMacro]; "Ping");
Notes:
1. Ping and Pong are identical, except in the @Command([ToolsRunMacro]) line.
2. The 'fancy processing stuff' can include @Commands!
3. Ping and Pong must always finish at the view level, so that they can execute the @Command([ToolsRunMacro]) command.