Add Loop

From VoxCommando
Jump to: navigation, search


Click the Add Loop.png icon to create a new loop block.

A loop allows you to execute a sequence of actions multiple times within a macro.

In programming language the loop will behave like the following C# code:

Loop block.jpg
for ( j = 1 to 10 )
{
   action 1
   action 2
   ...
}



  • A loop is defined using two values, (a starting and ending value)
    • for j= ___ sets the starting value of j
    • to ___ sets the ending value of j.
    • for j= value should be less than to value, or the loop will only execute once.
  • The loop will start at the for j= value, execute all actions in the block and then repeat, incrementing j until the to value is reached.
  • Each time the loop executes:
    • All actions in the loop block will be executed in sequence.
    • The value of j will be increased by 1. You can use this j variable in your actions by writing {j} just as you would use {i} when repeating a single action. When the action executes, {j} will be replaced by the current value of j.
  • Variables such as payloads can be used for the for j= and to values.
  • A loop can only contain actions, not logic blocks. Although this would be nice, it is at this time too difficult to implement.
  • A loop block cannot be dragged to reorder it but you can use the blue arrows on the left of the block to move it up and down in your macro. As usual, actions can be dragged into and out of the loop and you can use ctrl-click-drag to copy actions.

A simple example using a loop in a macro can be found on the forum here: http://voxcommando.com/forum/index.php?topic=2171.msg18770#msg18770