The renewal maintenance has officially ended for Progress iMacros effective November 30, 2023.
This Wiki site will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely, The Progress Team
Difference between revisions of "!LOOP"
(→Value) |
|||
(9 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | + | Contains the current loop number when playing a macro in loop/repeat mode. This value is set automatically by iMacros each time the macro repeats as a result of using the Play Loop button (iMacros for Firefox and Chrome) or setting the Repeat value in the sidebar (iMacros browser and iMacros for IE). | |
− | + | The !LOOP variable is especially useful together with the POS attribute of the [[TAG]] command for iterating over elements on a page, e.g. search result links. | |
− | + | You can also explicitly [[SET]] a value for !LOOP at the beginning of the macro to force a different starting value (the default value is 1). For example, you might use SET !LOOP 2 if you are using the !LOOP variable with SET [[!DATASOURCE_LINE]] to control the current line/row of an input file and you want it to skip the header row. | |
− | Any integer | + | === Value [[Image:IMacros-icon.png|iMacros Browser]] [[Image:Ie-icon.png|IE Plug-in]] [[Image:Ff-icon.png|Firefox]] [[Image:Cr-icon.png|Chrome]]=== |
+ | |||
+ | Any integer 1,2,3,4,5,.... | ||
+ | |||
+ | === Set By === | ||
+ | [X] Internal | ||
+ | |||
+ | [X] [[SET]] | ||
+ | |||
+ | '''Internal''' means that the iMacros program itself sets the value of the variable during program run. [[SET]] means that the user can set this value via the [[SET]] command inside a macro. | ||
=== Examples === | === Examples === | ||
+ | * There is a [http://www.youtube.com/watch?v=3Ayo-H1mAgc demo video]. | ||
+ | * Related example macros: [[Demo-Slideshow]] | ||
+ | |||
+ | === Notes === | ||
− | + | * The command to explicitly set the value of !LOOP is only executed once. So if you use the following to e.g. skip the header row of an input file, it will be ignored for every loop run except the first one. | |
+ | SET !LOOP 2 | ||
+ | * The !LOOP variable is never set as a result of calling a macro using the scripting interface ([[iimPlay]]). It is only set when playing the macro directly from the sidebar or from the command line using the [[-loop]] switch. To loop a macro using the scripting interface, the user must setup the loop using whatever loop construct is appropriate for the scripting/programming language they are using, and pass in their own user-defined loop variable to the macro. See [[VBS looping]] for a quick VBScript example. | ||
=== See Also === | === See Also === | ||
+ | [[Form Filling#Input from Comma Separated Data (CSV) File|Input from Comma Separated Data (CSV) File]], [[Demo-Loop-Csv-2-Web]], [[VBS looping]], [[Loop after Query or Login]] |
Revision as of 08:28, 16 May 2018
Contains the current loop number when playing a macro in loop/repeat mode. This value is set automatically by iMacros each time the macro repeats as a result of using the Play Loop button (iMacros for Firefox and Chrome) or setting the Repeat value in the sidebar (iMacros browser and iMacros for IE).
The !LOOP variable is especially useful together with the POS attribute of the TAG command for iterating over elements on a page, e.g. search result links.
You can also explicitly SET a value for !LOOP at the beginning of the macro to force a different starting value (the default value is 1). For example, you might use SET !LOOP 2 if you are using the !LOOP variable with SET !DATASOURCE_LINE to control the current line/row of an input file and you want it to skip the header row.
Value
Any integer 1,2,3,4,5,....
Set By
[X] Internal
[X] SET
Internal means that the iMacros program itself sets the value of the variable during program run. SET means that the user can set this value via the SET command inside a macro.
Examples
* There is a demo video. * Related example macros: Demo-Slideshow
Notes
- The command to explicitly set the value of !LOOP is only executed once. So if you use the following to e.g. skip the header row of an input file, it will be ignored for every loop run except the first one.
SET !LOOP 2
- The !LOOP variable is never set as a result of calling a macro using the scripting interface (iimPlay). It is only set when playing the macro directly from the sidebar or from the command line using the -loop switch. To loop a macro using the scripting interface, the user must setup the loop using whatever loop construct is appropriate for the scripting/programming language they are using, and pass in their own user-defined loop variable to the macro. See VBS looping for a quick VBScript example.
See Also
Input from Comma Separated Data (CSV) File, Demo-Loop-Csv-2-Web, VBS looping, Loop after Query or Login