Using JavaScript to Loop through CSV (Error code: -911)

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
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
Riss
Posts: 8
Joined: Tue Jan 24, 2012 12:36 am

Using JavaScript to Loop through CSV (Error code: -911)

Post by Riss » Wed Mar 07, 2012 9:42 pm

Hey

I'm trying to use Windows Task Scheduler to run my Macro in the Firefox add-on. I'm having to use JavaScript to allow the macro to loop through data in a CSV file - Yesterday during testing this was working but this morning I am getting the following error;

BadParameter: !DATASOURCE_LINE must be positive integer, line: 6 (Error code: -911)

I have no previous JavaScript experience so everything I've done has been copied from other threads I've found on this forum.

My iMacro Code is below - If I remove the reference to the .js file and use 'Play (Loop)' in the UI it works...

Code: Select all

VERSION BUILD=7300701 RECORDER=FX
SET !REPLAYSPEED FAST
SET !DATASOURCE CC_Extracts-Create.csv
SET !DATASOURCE_COLUMNS 5
SET !LOOP 2
SET !DATASOURCE_LINE {{MyLoop}}
TAB T=1
URL GOTO=https://mywebsitehere
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:loginForm ATTR=ID:loginForm_username CONTENT=LOGINNAME
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:loginForm ATTR=ID:loginForm_password CONTENT=PASSWORD
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:loginForm ATTR=ID:loginForm_login
URL GOTO=https://mywebsitehere/finance
TAG POS=1 TYPE=SPAN ATTR=TXT:Credit<SP>Card<SP>Extracts
TAG POS=1 TYPE=INPUT:RADIO FORM=ID:form ATTR=ID:form_selection_issue
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form ATTR=ID:form_continueButton
TAG POS=1 TYPE=SELECT FORM=NAME:form ATTR=ID:creditCardExtractType CONTENT=%{{!COL1}}
TAG POS=1 TYPE=SELECT FORM=NAME:form ATTR=ID:branch CONTENT=%{{!COL3}}
TAG POS=1 TYPE=SELECT FORM=NAME:form ATTR=ID:bankAccount CONTENT=%{{!COL5}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form ATTR=ID:extract
TAG POS=1 TYPE=A ATTR=TXT:Logout
This leaves me to believe that the issue is with my .js file, code below; Can anyone please help??

Code: Select all

for (i = 0; i < 142; i++)
{
  iimSet('MyLoop', i);
  iimPlay("CC Extracts-Createv1.iim");
}
skippyto
Posts: 108
Joined: Wed Aug 20, 2008 8:14 am

Re: Using JavaScript to Loop through CSV (Error code: -911)

Post by skippyto » Mon Mar 12, 2012 9:05 am

The first line of a datasource file is 1(not 0), so try to init your loop at 1 !

It should be like "for (i = 1; i < 142; i++)" or "for (i = 1; i < 143; i++)"

Skippyto.
Post Reply