Varied data in looped runs (Undefined when using csv)

Discussions and Tech Support specific to the iMacros for Chrome extension.
Forum rules
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
padib_pqa
Posts: 11
Joined: Mon Jan 10, 2011 1:53 pm

Varied data in looped runs (Undefined when using csv)

Post by padib_pqa » Mon Jan 10, 2011 2:14 pm

Hi techsupport, (thanks for an excellent tool by the way)

I'm trying to use many sets of data so my runs create different customer entries. To test it, I'm running a simpler operation. I set up imacros to run 3 google image searches on 3 different search strings, 1 search per loop.

To achieve that, I'm using the Datasource functionality in iMacros v.3.0.2 . The macro runs, but runs only once (doesn't loop 3 times), and inputs the value undefined in google search. Below are the details.

Macro Code:

Code: Select all

VERSION BUILD=3020924 RECORDER=CR
SET !DATASOURCE Google_Search_Tokens.csv 
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}} 

URL GOTO=http://www.google.ca/
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=NAME:q CONTENT={{!COL0}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:f ATTR=NAME:btnG&&VALUE:Google<SP>Search
TAG POS=1 TYPE=A ATTR=ID:gb_2
And the csv file Google_Search_Tokens.csv:

Code: Select all

"TOKEN"
"nasa"
"kangaroos"
"imacros"
Basically, this is just trying to loop through 3 search tokens, run google search and visit the images page for each one.

At first, iMacros couldn't find the file on my desktop. It gave me error:
Data source file does not exist, line: 2
, so I added a datasources directory in my Macros directory path and placed the csv file there. The error went away.

Next, I was using {{!COL1}} to fetch the value for column "TOKEN". I was given error msg:
Column number 1 greater than total number of columns 0, line: 7

So, I changed that to {{!COL0}}. Now, the macro runs, but runs only once (doesn't loop 3 times), and inputs the value undefined in google search.

Thanks for the help.
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Varied data in looped runs (Undefined when using csv)

Post by Daniel, Tech Support » Fri Jan 14, 2011 2:14 pm

Hi,

What if you add

Code: Select all

SET !DATASOURCE_COLUMNS 1
after

Code: Select all

SET !DATASOURCE Google_Search_Tokens.csv 
, will that fix it?
So, I changed that to {{!COL0}}
Sorry, you need to change it back as numeration does start with 1.
Now, the macro runs, but runs only once (doesn't loop 3 times)
Are you using the "Play (Loop)" button?

Hope this helps! Please let me know if not!

Best wishes,
Daniel, iOpus Support
padib_pqa
Posts: 11
Joined: Mon Jan 10, 2011 1:53 pm

Re: Varied data in looped runs (Undefined when using csv)

Post by padib_pqa » Fri Jan 14, 2011 2:23 pm

It worked!

I am indeed using the playloop button.
Instead of
Current 1 Max: 3
I used
current: 2 Max: 4
It translates automatically back to Current: 1 Max: 4 by iMacros, but it still works because I'm skipping the first line of the csv file with command SET !LOOP 2

The final code here, runs 3 google image searches (for testing):

Code: Select all

VERSION BUILD=3020924 RECORDER=CR
SET !DATASOURCE_COLUMNS 1
SET !DATASOURCE Google_Search_Tokens.csv 
SET !LOOP 2
SET !DATASOURCE_LINE {{!LOOP}} 

URL GOTO=http://www.google.ca/
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:f ATTR=NAME:q CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:f ATTR=NAME:btnG&&VALUE:Google<SP>Search
TAG POS=1 TYPE=A ATTR=ID:gb_2
Note: If you're running this on another version of iMacros, you may want to edit the 1st line.

Ty!
Phil
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Varied data in looped runs (Undefined when using csv)

Post by Daniel, Tech Support » Fri Jan 14, 2011 2:41 pm

Phil, that's super! Thanks for sharing!
Daniel, iOpus Support
padib_pqa
Posts: 11
Joined: Mon Jan 10, 2011 1:53 pm

Re: Varied data in looped runs (Undefined when using csv)

Post by padib_pqa » Fri Jan 14, 2011 2:43 pm

Anytime ;)
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: Varied data in looped runs (Undefined when using csv)

Post by Daniel, Tech Support » Fri Jan 14, 2011 3:03 pm

:))
Daniel, iOpus Support
Post Reply