Search code examples
javascriptloopscsvnested-loopsimacros

imacros | login and loop (Second loop)


I've created this simple script. It logs in to reverbnation.com using a csv file and goes to the links and follow them. So there are two csv file 1-accounts 2-links

What I want is to loop the whole links.csv file and go to next account. Then loop the same links csv file.How to do this? Thanks.

SET !DATASOURCE accounts.csv

SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}
TAB T=1 

URL GOTO=http://www.reverbnation.com/user/login
FRAME F=1
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:/user/secure_login_submit?message_region=become_fan_login_popup_message ATTR=NAME:user[login] CONTENT={{!COL1}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=ACTION:/user/secure_login_submit?message_region=become_fan_login_popup_message ATTR=NAME:user[password] CONTENT={{!COL2}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:/user/secure_login_submit?message_region=become_fan_login_popup_message ATTR=NAME:commit

SET !DATASOURCE links.csv 

URL GOTO={{!COL1}}
TAG POS=2 TYPE=A ATTR=TXT:Become<SP>A<SP>Fan

Solution

  • you've described a loop inside a loop. What you need is a JavaScript scripting. Load links from one file and accounts from another file.

    for(var main_loop=0;main_loop<=number_of_accounts;main_loop++)
    {
    
    //login to website
    
    
    for(var links_loop;links_loop<=number_of_links;links_loop++)
    {
    
    //do the links part
    
    }
    
    
    }
    

    This would be a setup of code.

    And this is search option of stack.

    https://stackoverflow.com/search?tab=newest&q=imacros%20javascript

    And this is my profile:

    https://stackoverflow.com/users/1452141/macroscripts?tab=answers

    And this is also profile with answers to iMacros.

    https://stackoverflow.com/users/1933073/bestmacros?tab=answers