casusbelli
casusbelli

Reputation: 463

How to loops imacros using with javascript using extract element

I'm working on a imacro script which re-post content from my website to social websites.

media_raw check if there is new content. raw is the number of new posts.

The issue is that the loop is not working with raw variable as condition. Its working fine if I set a number manually.

var media_raw;
media_raw ="CODE:";
media_raw +="SET !ERRORIGNORE YES "+"\n";
media_raw +="URL GOTO=http://www.website.com/share/index.php "+"\n";
media_raw +="TAG POS=1 TYPE=SPAN ATTR=CLASS:media_row EXTRACT=TXT     "+"\n";
media_raw +="SET !VAR1 {{!EXTRACT}} "+"\n";

iimPlay(media_raw)

var raw = iimGetLastExtract();

for(var i=0;i<raw;i++)
{
iimPlay("fb.iim")
iimPlay("twitter.iim")
}

Upvotes: 0

Views: 96

Answers (1)

Shugar
Shugar

Reputation: 5299

Try to use the parseInt() function:

var raw = parseInt(iimGetLastExtract());

Upvotes: 1

Related Questions