I’ve been looking for this article on several occasions, and there it was, in LinkedIn! Re-posting here….
So, you want to do a loop in Labtech. No problem – as long as you keep a few things in mind.
First, you have to follow the logic! Use script notes to let yourself know what you want to accomplish. Also, you need to use Labels and Script GoTo to create the loop. Labels are Script Notes with “:” preceding the label. Short, simple labels are best. Know where you want to exit the loop and when to continue the loop.
In the above image, we are taking a “String of Stuff” and splitting it, then parsing the string for each start and taking two characters after that to be a Percent Free.
Note the “SET: @Counter@ = @Counter@ – 1” entry. This is a Script Math line. It is, however, not written as shown. If you put @Counter@ in the variable section, it will use the Value of the variable previously set, so you may wind up with @4@ set to ‘3’ if you try this.
Despite what the description says, it does matter whether you use @ or not!
In order to do a Loop successfully, you need to make sure that the “Variable” section of each Variable Set, Script Math, etc. that may change value in the loop (or otherwise) does not have the ‘@’ with the variable name.