Make {{!LOOP}} increase by 10 in iMacros

Liu Kang picture Liu Kang · Mar 28, 2014 · Viewed 33.5k times · Source

I have problems with making !LOOP jump +10 each time instead of +1.

Here is my code:

VERSION BUILD=8810214 RECORDER=FX
TAB T=1

SET !ERRORIGNORE YES
SET !VAR1 100
SET !LOOP {{!VAR1}}

URL GOTO=http://www.example.com/lui/?page={{!LOOP}}

WAIT SECONDS=1

ADD !VAR1 10

Running this still makes iMacros jump +1 each loop.

Above sample goes to page=100,page=101,page=102,page=103 instead of page=100,page=110,page=120

Best regards,

Lui Kang

Answer

kev picture kev · Mar 28, 2014

The variable {{!LOOP}} represents the current loop number when a script is running in loop mode.

You can still get 100,110,120... via a javascript expression: init+step*loop.

Try the EVAL command:

SET !LOOP 0
SET INIT 100
SET STEP 10
SET VALUE EVAL("{{INIT}}+{{STEP}}*{{!LOOP}}")
URL GOTO=http://www.example.com/lui/?page={{VALUE}}