user2974581
user2974581

Reputation: 11

how to change TAG POS in .js file in iMacros

I spent a lot of time and I thought my code was right but somehow iMacros gives an error message

SyntaxError: missing ; before statement, line: 7 (Error code: 991) 

I think, it is because of POS={{n}}

Basically, I want to extract 10 txt one by one and use it to locate the HREF, EXTRACT the HREF and OPEN it in a different TAB but the problem is that the TAG POS keeps changing.

Here is the code

var macro1= "CODE:";
macro1 +=  "VERSION BUILD=8530828 RECORDER=FX" + "\n";
macro1 +=  "SET !ERRORIGNORE YES" + "\n";
macro1 +=  "SET !TIMEOUT_PAGE 60" + "\n";
macro1 +=  "TAB T=1" + "\n";
macro1 +=  "SET !LOOP 1" + "\n"; // I tried removing this part but that didn't help either
macro1 +=  "TAG POS={{n}} TYPE=SPAN ATTR=CLASS:"itemLabel fcb" EXTRACT=TXT" + "\n"; //this is the part that i don't seem to get
macro1 +=  "SET TITLE {{!EXTRACT}}" + "\n";
macro1 +=  "SET !EXTRACT NULL" + "\n";
macro1 +=  "TAG POS=1 TYPE=A ATTR=TITLE:"{{TITLE}}" EXTRACT=HREF" + "\n"; 
macro1 +=  "TAB OPEN" + "\n";
macro1 +=  "TAB T=2" + "\n";
macro1 +=  "URL GOTO={{!EXTRACT}}" + "\n";
macro1 +=  "SET !EXTRACT NULL" + "\n";
macro1 +=  "TAB T=1" + "\n";
macro1 +=  "TAB CLOSEALLOTHERS";
for (var i=1;i<=10;i++)
{

  iimSet("n",i);
  iimPlay(macro1);

}

Upvotes: 1

Views: 800

Answers (4)

Sajjad
Sajjad

Reputation: 1

Use Single quotes Instead of Double quotes for e.g.

macro1 +=  "VERSION BUILD=8530828 RECORDER=FX" + "\n";

to this one

macro1 +=  'VERSION BUILD=8530828 RECORDER=FX' + '\n;'

Upvotes: 0

Bestmacros
Bestmacros

Reputation: 1867

Here are some fixes which may help:

  1. remove <br> from your code - you do not need this
  2. iimSet("n",i); - replace n with different parameter name
  3. use internal variable like !var1 instead of "title"
  4. replace

    TAG POS={{n}} TYPE=SPAN ATTR=CLASS:"itemLabel fcb" EXTRACT=TXT
    

    with

    TAG POS={{qqq}} TYPE=SPAN ATTR=CLASS:itemLabel<SP>fcb EXTRACT=TXT
    

Upvotes: 1

Rafayet Ullah
Rafayet Ullah

Reputation: 1158

You can use n as iMacros variable with double curly braces like {{n}}.

This error message was due to LINE 7 on your code. Replace this line

macro1 +=  "TAG POS={{n}} TYPE=SPAN ATTR=CLASS:"itemLabel fcb" EXTRACT=TXT" + "\n";

with

macro1 +=  "TAG POS={{n}} TYPE=SPAN ATTR=CLASS:itemLabel<SP>fcb EXTRACT=TXT" + "\n";

also use TAB CLOSE before TAB T=1.

macro1 +=  "TAB CLOSE" + "\n";
macro1 +=  "TAB T=1" + "\n";

Upvotes: 0

Dang Cong Duong
Dang Cong Duong

Reputation: 506

You can use:

iimSet("n",i); 
  • i: javascript
  • n: imacros with variable {{n}}

Upvotes: 0

Related Questions