Break
The Break command may be used with the Repeat commands, Process a Text File or Process ASCII Text File commands. Each of these commands processes data in a loop. Use the Break command to exit out of a loop before the entire cycle is completed.
There is not an edit window associated with this command. From the Logic category of commands click on the Break command to insert it directly into the script.
For example, create conditional statements within the Process File or Repeat loops using If commands. If the condition is met, the Break command exits out of the loop instead of continuing through the entire process. The macro skips all other steps in the loop. It resumes playback with the first command in the script found after the End Repeat or End Process command and finishes the rest of the macro.
Sample Macro
Here's an example of how this would work. The first few commands count the number of files in a folder. When the macro loops to the 30th file, it breaks out of the Repeat loop. It sends an email containing the data appended to the text file selected in line seven of the macro.
1. Variable Set Integer %N[1]% to 0 2. Repeat with Folder C:\Downloads\Macro Express 3. Variable Modify Integer: %N[1]% = %N[1]% + 1 4. If Variable %N[1]% Equals 30 5. Break 6. End If 7. Variable Modify String: Append %T[1]% to "C:\Macexp.txt" 8. End Repeat 9. Email Send: Know Recipients, Fixed Text, Attachments |
❖Note: The Repeat Exit command performs the same function as the Break command within repeat loops. Use the Continue command if needing to skip to the end of the Repeat or Process File loop and return to process the next record or continue repeating.