1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

iMacros LOOP Problem - multiple CSV records with multiple URLs

Discussion in 'Black Hat SEO Tools' started by InfoField, Feb 4, 2010.

  1. InfoField

    InfoField Newbie

    Joined:
    Sep 21, 2009
    Messages:
    7
    Likes Received:
    0
    Hi Folks,
    I am trying to use a single CSV file with multiple records and loop them in different URLs.
    Go to URL1 and extract CSV Record 1
    Go to URL2 and extract CSV Record 2
    and so on...

    Is it possible to accomplish this without using JavaScript or VBS?
    What happens now is that the same CSV record is being posted to URL1 and URL2.

    Thanks.
     
  2. Mr.Profit

    Mr.Profit Regular Member

    Joined:
    Dec 22, 2009
    Messages:
    219
    Likes Received:
    471
    Occupation:
    Marketer and SEO
    Location:
    Internet
    Home Page:
    If I do understand your sittuation correctly you should have at least 2 columns and multiply rows in your csv file, e.g.

    URLs,CSV Record
    URL1,CSV Record1
    URL2, CSV Record2
    .......


    And in the macro you should use the two columns, like in the following example:
    Code:
    VERSION BUILD=6311226 RECORDER=FX
    '
    SET !ERRORIGNORE YES
    SET !ERRORCONTINUNE YES
    '
    '
    CMDLINE !DATASOURCE Sample.csv
    SET !DATASOURCE_COLUMNS 2
    SET !LOOP 2
    SET !DATASOURCE_LINE {{!LOOP}}
    '
    TAB T=1
    URL GOTO={{!COL1}}
    FRAME F=0
    TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=NAME:q CONTENT={{!COL2}}
    TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:f ATTR=TYPE:submit
    
    The source file (Sample.csv) for the above example should look like this:

    Code:
    SearchEngineURL,Keyword
    google.com,keyword1
    google.de,keyword2
    google.es,keyword3
    .........
    What this macro will do is the following:
    1. Read the source file
    2. Go to the URL from Column1 - the {{!COL1}} variable
    3. Enter the data from Column2 in the search box - the {{!COL2}} variable
    4. Hit the "Google Search" button...

    I hope you get the point, and this will help you...


    Good Luck,
    Mr.P
     
    • Thanks Thanks x 1
  3. InfoField

    InfoField Newbie

    Joined:
    Sep 21, 2009
    Messages:
    7
    Likes Received:
    0
    Hi bro,
    Actually my code looks the same as yours, however your post pointed me to the right direction as I had more than one URL GOTO= so I need to thank you about that as for luck the different URLs in my CSV have the same HTML structure.
    However what will be the code inside the iim file if URL1 and URL2 have different HTML structure and logic. In your example you included the URL as a column in the CSV, but what if we assign the URL inside the iim file, then we need to enter a second block of text in the iim and the code you pasted will look something like that:

    VERSION BUILD=6311226 RECORDER=FX
    '
    SET !ERRORIGNORE YES
    SET !ERRORCONTINUNE YES
    '
    '
    CMDLINE !DATASOURCE Sample.csv
    SET !DATASOURCE_COLUMNS 2
    SET !LOOP 2
    SET !DATASOURCE_LINE {{!LOOP}}
    '
    TAB T=1
    URL GOTO= http://url1dot-com
    FRAME F=0
    TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=NAME:q CONTENT={{!COL2}}
    TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:f ATTR=TYPE:submit

    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''BLOCK 2''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ''''''''here we go with the second URL with different HTML (FORM) structure or name''''''''''


    URL GOTO=http://url2dot-com
    FRAME F=0
    TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f2 ATTR=NAME:q2 CONTENT={{!COL2}}
    TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:f2 ATTR=TYPE:submit


    >>>>>>>>>>>>>>>>>>>>>>

    Now my question do we need to declare in BLOCK 2 again:

    CMDLINE !DATASOURCE Sample.csv
    SET !DATASOURCE_COLUMNS 2
    SET !LOOP 2
    SET !DATASOURCE_LINE {{!LOOP}}

    and if we declare it then why the loop starts again from the first record in the CSV file?

    Let me know what you think.

    Thanks.
     
  4. Mr.Profit

    Mr.Profit Regular Member

    Joined:
    Dec 22, 2009
    Messages:
    219
    Likes Received:
    471
    Occupation:
    Marketer and SEO
    Location:
    Internet
    Home Page:
    Okay, good morning first,

    Now it seems that you are trying to access two urls within one csv file. This could be done in several ways:
    1. You could divide the URLs by HTML structure and make different csv file for each html structure. So in that case you could have SampleURLs1.csv and SampleURLs2.csv.

    In this case in the code you will call SampleURLs1.csv for the fist block, and after that for block 2 you will call SampleURLs2.csv, and the loop will read from separate files, which might solve the problem.

    2. You could make the csv file with more than 2 columns, and it will look like this:

    URL1,DataForURL1,URL2,DataForURL2
    url1.com,Sampledata,url2.com,Sampledata2
    url11.com,sampledata,url22.com,sampledata2
    .........

    If you go by this route, you will call only one csv file in the macro, and will be using only the {{!COLX}} variable, where X is 1,2,3,4 depending on the action the macro should do.

    3. The last solution I can think of (If I do understand the problem of course) is you could make your csv file with 3 columns, like the following:
    URL1,DataForURL1,DataForURL2
    url1.com,sampledata1,sampledata2
    url11.com,sampledata11,sampledata22
    ......

    In this case you will have one "dynamic" URL in the macro and the second URL from Block 2 will be embeded into the code of the macro.

    I hope the above make sence to you, as I haven't even drunk my coffee yet.

    If you want you could send me the real problem via PM, and I will try to help you, IF of course the above don't do the job.

    Good Luck & Have a nice day man,
    Mr.P