iimSet can't set !DATASOURCE??

Discussions and Tech Support related to automating the iMacros Browser or Internet Explorer from any scripting and programming language, such as VBS (WSH), VBA, VB, Perl, Delphi, C# or C++.

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.

iimSet can't set !DATASOURCE??

by kind03cn on Wed Jan 07, 2015 7:10 pm

System: Windows 7 Professional Service Pack 1
Browser: Firefox 34.05
iMacros for Firefox 8.8.8

Javascript Code I used in iMacros for Firefox
re = iimSet("!DATASOURCE", "source.csv");
alert (re);
re = iimSet("NAME", "{{!COL1}}");
alert (re);
re = iimSet("!LOOP", 2);
alert (re);
macro = "CODE:PROMPT {{!COL1}}"
re = iimPlay(macro);
alert (re);

Every time I run this code, I get the following error message for the last two lines of the code
TypeError: this.dataSource[(line - 1)] is undefined, line 1 (Error code: -1001)

But if I use the following code
macro = "CODE:";
macro += "SET !DATASOURCE source.csv\n";
macro += "SET NAME {{!COL1}}\n";
macro += "SET !LOOP 2\n";
macro += "PROMPT {{!COL1}}";
re = iimPlay(macro);

This will be perfectly fine.
kind03cn
 
Posts: 16
Joined: Mon Nov 03, 2014 3:19 pm

Re: iimSet can't set !DATASOURCE??

by chivracq on Wed Jan 07, 2015 8:26 pm

kind03cn wrote:System: Windows 7 Professional Service Pack 1
Browser: Firefox 34.05
iMacros for Firefox 8.8.8

Javascript Code I used in iMacros for Firefox
re = iimSet("!DATASOURCE", "source.csv");
alert (re);
re = iimSet("NAME", "{{!COL1}}");
alert (re);
re = iimSet("!LOOP", 2);
alert (re);
macro = "CODE:PROMPT {{!COL1}}"
re = iimPlay(macro);
alert (re);

Every time I run this code, I get the following error message for the last two lines of the code
TypeError: this.dataSource[(line - 1)] is undefined, line 1 (Error code: -1001)

But if I use the following code
macro = "CODE:";
macro += "SET !DATASOURCE source.csv\n";
macro += "SET NAME {{!COL1}}\n";
macro += "SET !LOOP 2\n";
macro += "PROMPT {{!COL1}}";
re = iimPlay(macro);

This will be perfectly fine.

I understand what you want but I'm not surprised about the Result, to be honest...
In your first Example, when you call
Code: Select all
macro = "CODE:PROMPT {{!COL1}}"
re = iimPlay(macro);"
as an .iim Macro, it always starts with empty (Built-in) Variables, same at the end when all (Built-in) Variables are reset. I would think you need to call the Variables before they get activated/populated....

It could be a Bug but it could as well be by Design (TechSupport/Development to confirm...?), I could foresee Problems otherwise when looping a Macro...
(I guess I'm not too sharp at this moment, give me some more Arguments and I could think a bit deeper about it...)

And a mini-Rmk: "Every time I run this code, I get the following error message..." sounds like you enjoy SMSB... (=SadoMazoSofwareBugging)
=> I have a great Collection if you need some more orgasmic Experiences...!
- (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: 6477
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: iimSet can't set !DATASOURCE??

by kind03cn on Wed Jan 07, 2015 9:04 pm

chivracq wrote:I understand what you want but I'm not surprised about the Result, to be honest...
In your first Example, when you call
Code: Select all
macro = "CODE:PROMPT {{!COL1}}"
re = iimPlay(macro);"
as an .iim Macro, it always starts with empty (Built-in) Variables, same at the end when all (Built-in) Variables are reset. I would think you need to call the Variables before they get activated/populated....

It could be a Bug but it could as well be by Design (TechSupport/Development to confirm...?), I could foresee Problems otherwise when looping a Macro...
(I guess I'm not too sharp at this moment, give me some more Arguments and I could think a bit deeper about it...)

And a mini-Rmk: "Every time I run this code, I get the following error message..." sounds like you enjoy SMSB... (=SadoMazoSofwareBugging)
=> I have a great Collection if you need some more orgasmic Experiences...!


Thanks a lot for you explaining! iMacros should edit their Wiki for the item "iimSet" to clarify that all the built-in variable start with empty value every time you play them.

I change my code to the following and it works!!
re = iimSet("Datasource", "source.csv");
alert (re);
macro = "CODE:SET !DATASOURCE {{Datasource}}\n"
macro += "PROMPT {{!COL1}}"
re = iimPlay(macro);
alert (re + iimGetErrorText());
kind03cn
 
Posts: 16
Joined: Mon Nov 03, 2014 3:19 pm

Re: iimSet can't set !DATASOURCE??

by kind03cn on Wed Jan 07, 2015 9:31 pm

By the way... I just found I do have obsession on testing bugs... You are right...
kind03cn
 
Posts: 16
Joined: Mon Nov 03, 2014 3:19 pm

Re: iimSet can't set !DATASOURCE??

by chivracq on Thu Jan 08, 2015 1:51 am

kind03cn wrote:Thanks a lot for you explaining! iMacros should edit their Wiki for the item "iimSet" to clarify that all the built-in variable start with empty value every time you play them.

I change my code to the following and it works!!
Code: Select all
re = iimSet("Datasource", "source.csv");
alert (re);
macro = "CODE:SET !DATASOURCE {{Datasource}}\n"
macro += "PROMPT {{!COL1}}"
re = iimPlay(macro);
alert (re + iimGetErrorText());

No real need to thank me about my "Explanation", I don't really give an "Explanation", just my 2ct, based on my Experience, but I knew about the Reset of all Variables from personal Experience and I've seen mentioned several times by TechSupport (in the Wiki I thought but not sure, and on the Forum for sure, euh, yes, in the Wiki for sure as well, I've seen it again in the last week...)

Yep, the piece of Code you give, I would expect it to work indeed, as you call/define '!DATASOURCE' before calling '{{!COLn}}... All (Built-in) Variables are NULL when starting an .iim Macro, unless (per Default) defined in the General Settings...

kind03cn wrote:By the way... I just found I do have obsession on testing bugs... You are right...

Oh, good...!, welcome to the Club then, I would say...! :D
Last edited by chivracq on Fri Jan 09, 2015 1:34 pm, edited 1 time in total.
- (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: 6477
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: iimSet can't set !DATASOURCE??

by kind03cn on Thu Jan 08, 2015 9:55 pm

chivracq wrote:No real need to thank me about my "Explanation", I don't really give an "Explanation", just my 2ct, based on my Experience, but I knew about the Reset of all Variables from personal Experience and I've seen mentioned several times by TechSupport (in the Wiki I thought but not sure, and on the Forum for sure, euh, yes, in the Wiki for sure as well, I've seen it again in the last week...)

Yep, the piece of Code you give, I would expect it to work indeed, as you call/define '!DATASOURCE' before calling '{{!COLn}}... All (Built-in) Variables are NULL when starting an .iim Macro, unless (per Default) defined in the General Settings...


http://wiki.imacros.net/iimSet%28%29
in the Wiki of iimSet, the third sentence:
You can set all built-in variables which you also can set via the command line
kind03cn
 
Posts: 16
Joined: Mon Nov 03, 2014 3:19 pm


Return to Scripting and Command Line Interface

Who is online

Users browsing this forum: No registered users and 2 guests

-->