simple js loop not working

Discussions and Tech Support specific to the iMacros Firefox add-on.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
questions
Posts: 69
Joined: Wed Apr 23, 2008 9:23 pm

simple js loop not working

Post by questions » Sun Nov 10, 2013 7:05 am

I'm trying to run a javascript loop and having a problem:

for (var i=1;i<=40;i++)
{
iimPlayCode("TAG POS={{i}} TYPE=IMG ATTR=SRC:http://*.jpg")
}



it loops through the code just fine, but it won't click on the TAG POS=1,2,3, ... 40

it runs other commands inside the loop that don't depend on a variable, just not the line that has the variable in it...
User avatar
bobis
Posts: 364
Joined: Sat Sep 11, 2010 3:34 pm
Contact:

Re: simple js loop not working

Post by bobis » Sun Nov 10, 2013 6:12 pm

Code: Select all

for (var i=1;i<=40;i++)
{
iimSet("i",i);
iimPlayCode("TAG POS={{i}} TYPE=IMG ATTR=SRC:http://*.jpg")
}
Get Best iMacros scripts at http://imacrosbot.com/
questions
Posts: 69
Joined: Wed Apr 23, 2008 9:23 pm

Re: simple js loop not working

Post by questions » Sat Nov 16, 2013 3:34 am

Thanks that works!
questions
Posts: 69
Joined: Wed Apr 23, 2008 9:23 pm

Re: simple js loop not working

Post by questions » Sat Nov 16, 2013 3:45 am

now my problem is that my code isn't perfect, because the data on the page varies too much, so it tries to close tab 2 but it's really only in tab 1, so how do I put a javascript if operator on the tab and say "only close tab if you are in tab 2" and leave tab 1 open

what it's doing is closing tab 1 and exiting firefox...

any idea how to do this with javascript?
Post Reply