repeat macro to same row in csv file

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
super_hiro
Posts: 15
Joined: Tue Feb 23, 2010 2:06 pm

repeat macro to same row in csv file

Post by super_hiro » Mon Mar 01, 2010 7:20 pm

Hi,

Is it possible to automatically make a Macro repeat as many times as the amount of rows in csv file it's grabbing data from?

So if there's 3 rows worth of data on the csv file, make it repeat 3 times?
kcrowder
Posts: 20
Joined: Fri Feb 19, 2010 10:33 pm

Re: repeat macro to same row in csv file

Post by kcrowder » Mon Mar 01, 2010 8:22 pm

super_hiro
Posts: 15
Joined: Tue Feb 23, 2010 2:06 pm

Re: repeat macro to same row in csv file

Post by super_hiro » Mon Mar 01, 2010 9:25 pm

kcrowder wrote:see this wiki entry.
http://wiki.imacros.net/Demo-Loop-Csv-2-Web
Hi kcrowder,

Thank you for your help but that is kind of the same script I have, but what I want to do is make it repeat itself as many time as rows on my csv.
kcrowder
Posts: 20
Joined: Fri Feb 19, 2010 10:33 pm

Re: repeat macro to same row in csv file

Post by kcrowder » Mon Mar 01, 2010 9:38 pm

super_hiro
Posts: 15
Joined: Tue Feb 23, 2010 2:06 pm

Re: repeat macro to same row in csv file

Post by super_hiro » Mon Mar 01, 2010 9:50 pm

You're not understanding my question.

I have csv file that has 6 columns and it has 3 rows of it.

Instead of manually clicking to make the whole script repeat 3 times and click on Play loop, I want it to automatically repeat as many times as there are rows in that csv file.
kcrowder
Posts: 20
Joined: Fri Feb 19, 2010 10:33 pm

Re: repeat macro to same row in csv file

Post by kcrowder » Mon Mar 01, 2010 10:01 pm

You know,

you could've read that page.

http://www.iopus.com/imacros/help/index ... ut_csv.htm

once again:
We then need to tell iMacros how many columns the CSV file has in each line. We do that by using the !DATASOURCE_COLUMNS variable:

SET !DATASOURCE_COLUMNS 3

This number must match the exact number of columns in the input file, even if you do not use some columns.

Since we want to insert all datasets into the form, we need to loop over the macro, each time inserting the next CD. Therefore, we need to tell iMacros in which line of the datasource we currently are. We do this using the built-in variable !DATASOURCE_LINE. By cunningly using the built-in variable !LOOP, we let iMacros take care of the counting:

SET !DATASOURCE_LINE {{!LOOP}}

Now we can have the macro fill out the online form with the values from the current CD dataset. We use the built-in variables !COLn, where n represents the number of the columns to put into the form element.

TAG TYPE=INPUT:TEXT FORM=Listing ATTR=NAME:Name CONTENT={{!COL1}}
TAG TYPE=INPUT:TEXT FORM=Listing ATTR=NAME:Album CONTENT={{!COL2}}
TAG TYPE=INPUT:TEXT FORM=Listing ATTR=NAME:Price CONTENT={{!COL3}}

During the execution of the macro, the constants in parentheses {{..}} are replaced by the value specified in the data sources.

super_hiro
Posts: 15
Joined: Tue Feb 23, 2010 2:06 pm

Re: repeat macro to same row in csv file

Post by super_hiro » Mon Mar 01, 2010 11:28 pm

Are you saying

Code: Select all

SET !DATASOURCE_LINE {{!LOOP}}
is supposed to repeat the macro automatically?

Maybe I should explain further of how my script looks like.

I have SET !DATASOURCE_COLUMNS 9 and SET !DATASOURCE_LINE {{!LOOP}} on my script.

Throughout the script, I have {{!COL1}} ~ {{!COL9}} but only one of each.

Around the end of the script, it'll submit the value I have input from a csv file, load a new page and the script ends.

I have to manually enter 9 for the Repeat Macro option on the iMacros tab on firefox, and click on Play (Loop) so that it'll repeat 3 times and each time grabbing new line.
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: repeat macro to same row in csv file

Post by Daniel, Tech Support » Thu Mar 04, 2010 3:02 pm

Hello,
super_hiro wrote:Hi,

Is it possible to automatically make a Macro repeat as many times as the amount of rows in csv file it's grabbing data from?

So if there's 3 rows worth of data on the csv file, make it repeat 3 times?
Well, there are 2 options: either you run the macro from a script which determines the amount of rows and acts accordingly. Or you set the value in "Repeat Macro | Max" to a very big value and the script will run through all the rows :)

Best regards,
Daniel, iOpus Support
super_hiro
Posts: 15
Joined: Tue Feb 23, 2010 2:06 pm

Re: repeat macro to same row in csv file

Post by super_hiro » Fri Mar 12, 2010 7:40 pm

Daniel, iOpus wrote:Well, there are 2 options: either you run the macro from a script which determines the amount of rows and acts accordingly. Or you set the value in "Repeat Macro | Max" to a very big value and the script will run through all the rows :)

Best regards,
Could you tell me how to do both?
Daniel, Tech Support
Posts: 1483
Joined: Tue Jan 26, 2010 11:35 am

Re: repeat macro to same row in csv file

Post by Daniel, Tech Support » Tue Mar 16, 2010 2:28 pm

Or you set the value in "Repeat Macro | Max"
This is very easy - you set it and press the "Play (Loop)" button...
Daniel, iOpus Support
Post Reply