Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

LOOP function in iMacros (TAG POS)

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!!!

like image 944
navamauricio Avatar asked Mar 14 '13 17:03

navamauricio


People also ask

What are the tag fields used for in iMacros?

Typically these fields are used for uploading files. However, iMacros can fill these fields with the TAG command automatically. More details, including how to record such a command, can be found in Demo-Upload . Note: File upload is not yet available in iMacros for Firefox Quantum due to browser limitations.

How do I use the loop variable in a macro?

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).

How to run an iMacros code from a JavaScript function?

Then we hardcode the two macros being used as shown below and assign it a javascript variable, inside the loop iimplay () is a javascript function that can run imacros code. so we run (macroStart)"check next button" to check if next still exists. The function iimGetLastExtract () will get the last extracted value from the code.

How does iMacros store the value of the selected option?

By default the CONTENT parameter of TYPE=SELECT stores the value of the option, if that is available. Otherwise, iMacros uses the the display name of the chosen option. The third possibility is the position in the list (also called index) of the selected value.


Video Answer


1 Answers

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);
}
like image 162
Bestmacros Avatar answered Oct 17 '22 18:10

Bestmacros