Don't read another row in CSV file

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.

Moderators: Community Moderators, iMacros Moderators

Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the Google search box (at the top of each forum page) to see if a similar problem or question has already been addressed. This will search the entire contents of the forums as well as the iMacros Wiki.
3. We can respond much faster to your posts if you include the following information:

CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST

Answering your own posts (e.g. attempting to "bump" your topic) drops your topic from the list of unanswered threads, so it may actually receive less views.

Don't read another row in CSV file

by vvoyteq on Thu Dec 14, 2017 4:59 am

Hi everyone

I have problem with macros - don't read another row in CSV file, in the second step it always takes row 0.
File test.csv converted to UTF-8 without BOM.


My CSV file:
Code: Select all
3760582
3760578
3760576
3760574


My macros:
Code: Select all
SET !DATASOURCE C:\test.csv
WAIT SECONDS=5
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:searchBox CONTENT={{!COL1}}
TAG POS=1 TYPE=IMG ATTR=SRC:https://test.tt.pp/drop-search.gif
WAIT SECONDS=1
TAG POS=1 TYPE=LI ATTR=TXT:Read<SP>to<SP>me.
WAIT SECONDS=1


Could please anyone help me?

Thanks in advance

Wojtek
vvoyteq
 
Posts: 1
Joined: Thu Dec 14, 2017 4:17 am

Re: Don't read another row in CSV file

by chivracq on Thu Dec 14, 2017 8:13 am

vvoyteq wrote:Hi everyone

I have problem with macros - don't read another row in CSV file, in the second step it always takes row 0.
File test.csv converted to UTF-8 without BOM.

My CSV file:
Code: Select all
3760582
3760578
3760576
3760574


My macros:
Code: Select all
SET !DATASOURCE C:\test.csv
WAIT SECONDS=5
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:searchBox CONTENT={{!COL1}}
TAG POS=1 TYPE=IMG ATTR=SRC:https://test.tt.pp/drop-search.gif
WAIT SECONDS=1
TAG POS=1 TYPE=LI ATTR=TXT:Read<SP>to<SP>me.
WAIT SECONDS=1


Could please anyone help me?

Thanks in advance

Wojtek

CIM...! :mrgreen: (Read my Sig...)

And try to select the "correct" Sub-Forum when you open a Thread, your Thread has nothing specific to iMacros for FF, especially if you don't even mention your FCI... (Correct Sub-Forum would have been the 'General' one in this Case, but no need to duplicate now...)

Euh..., there is no "Row_0" in a '.CSV', the "first" Row starts at "Row_1"...

But OK, yep, the Behaviour you describe is normal from looking at your Script... When looping your Macro, you need to tell it to go and fetch '{{!COL1}}' to the next Rows by using the '!DATASOURCE_LINE' Command with:
Code: Select all
SET !DATASOURCE_LINE {{!LOOP}}

And "Good Practice" is to include a "SET !LOOP 1" in your Script, even if that's already the Default like you've already found out, but that Line would be required with a "SET !LOOP 2" if you had a Header in your '.CSV'..., and another "Advantage" is that if your 'CSV' contains, say 50 Rows, and for any Reason, your Script aborts at say Loop_27 (=Row_27), then you would specify "SET !LOOP 27" when you rerun your Script, to start directly at Row_27 again, and to avoid running Rows_[1-26] again as they have already been processed correctly... :idea:

=> Your Script should become stg like:
Code: Select all
SET !DATASOURCE C:\test.csv
SET !LOOP 1
SET !DATASOURCE_LINE {{!LOOP}}

WAIT SECONDS=5
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:searchBox CONTENT={{!COL1}}
TAG POS=1 TYPE=IMG ATTR=SRC:https://test.tt.pp/drop-search.gif
WAIT SECONDS=1
TAG POS=1 TYPE=LI ATTR=TXT:Read<SP>to<SP>me.
WAIT SECONDS=1
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
 
Posts: 6687
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)


Return to iMacros for Firefox

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 11 guests

-->