LOOP function in iMacros (TAG POS)

navamauricio picture navamauricio · Mar 14, 2013 · Viewed 24.9k times · Source

I have this code:

VERSION BUILD=7601105 RECORDER=FX
SET !TIMEOUT_PAGE 10
SET !ERRORIGNORE YES
TAB T=1

CMDLINE !DATASOURCE tags.csv
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE_LINE {{!LOOP}}
SET !VAR1 {{!LOOP}}

'***** enter all hashtags and likes here
'1
URL GOTO=http://web.stagram.com/tag/{{!COL1}}/
WAIT SECONDS=5
TAG POS={{!LOOP}} TYPE=IMG ATTR=SRC:http://cdn.stagram.com/img/like.png
WAIT SECONDS=2
TAG POS={{!LOOP}} TYPE=IMG ATTR=SRC:http://cdn.stagram.com/img/like.png
WAIT SECONDS=2
TAG POS={{!LOOP}} TYPE=IMG ATTR=SRC:http://cdn.stagram.com/img/like.png
WAIT SECONDS=2
TAG POS={{!LOOP}} TYPE=IMG ATTR=SRC:http://cdn.stagram.com/img/like.png
WAIT SECONDS=2
TAG POS={{!LOOP}} TYPE=IMG ATTR=SRC:http://cdn.stagram.com/img/like.png
WAIT SECONDS=2
TAG POS={{!LOOP}} TYPE=IMG ATTR=SRC:http://cdn.stagram.com/img/like.png
WAIT SECONDS=2
TAG POS={{!LOOP}} TYPE=IMG ATTR=SRC:http://cdn.stagram.com/img/like.png
WAIT SECONDS=2
TAG POS={{!LOOP}} TYPE=IMG ATTR=SRC:http://cdn.stagram.com/img/like.png
WAIT SECONDS=2
TAG POS={{!LOOP}} TYPE=IMG ATTR=SRC:http://cdn.stagram.com/img/like.png
WAIT SECONDS=2
TAG POS={{!LOOP}} TYPE=IMG ATTR=SRC:http://cdn.stagram.com/img/like.png
WAIT SECONDS=2

See how all the links are the same, I want to loop 10 times to the next link in the same url instead of having to copy/paste the TAG POS command 10 times.

Thanks!!!

Answer

Bestmacros picture Bestmacros · Mar 14, 2013

you can't do this with regular imacros, but you can with jaavscript version. something like this:

var macro;
macro =  "CODE:";
macro +=  "TAG POS={{i}} TYPE=IMG ATTR=SRC:http://cdn.stagram.com/img/like.png" + "\n"; 
macro +=  "WAIT SECONDS=2" + "\n"; 
for(i=1;i<=10;i++){
iimSet("i",i);
iimPlay(macro);
}