Cannot run in linux, a iim script running on windows

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
alete
Posts: 13
Joined: Sun Sep 07, 2014 11:03 pm

Cannot run in linux, a iim script running on windows

Post by alete » Mon Oct 01, 2018 7:20 pm

Hello, fellows!

I have a simple script that reads a data.csv file and fills a form for me looping over its rows.
It looks like this:

Code: Select all

VERSION BUILD=8920312 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ; 
SET !DATASOURCE c:/datos.csv
SET !LOOP 458
URL GOTO=https://idb14/LectorMySQL/alta_m.php?tabla=Alumnos&ar=ok
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:alta_m_ok.php ATTR=NAME:ApellidoYNombre CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:alta_m_ok.php ATTR=NAME:NroDeDocumento CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:alta_m_ok.php ATTR=NAME:Email CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:alta_m_ok.php ATTR=NAME:Nacionalidad CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:alta_m_ok.php ATTR=NAME:PaisDeOrigen CONTENT={{!COL5}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:alta_m_ok.php ATTR=NAME:LugarDeTrabajo CONTENT={{!COL6}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:alta_m_ok.php ATTR=NAME:Submit
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:AltaConfirmacion.php ATTR=NAME:Submit
WAIT SECONDS=1
I made it a few years ago, and still works like a charm on this config:
Windows 7, Firefox: 49.0.2, iMacros 9.0.3 (see @chivracq I know what FCI is :lol: )

but I cannot make it run in:
debian 9, firefox 49.0b, iMacros 9.0.3
off course that I changed the path of the file for a valid one, (like: /media/alejandro/WinDrive/datos.csv) and that doesn't seem to be the problem.

When I run this script in linux in slow mode, it goes ok until first TAG line and I get:

Code: Select all

this.dataSource[(line - 1)] is undefined, line: 7 (Error code: -1001)
chivracq
Posts: 8217
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Cannot run in linux, a iim script running on windows

Post by chivracq » Mon Oct 01, 2018 7:52 pm

alete wrote:Hello, fellows!

I have a simple script that reads a data.csv file and fills a form for me looping over its rows.
It looks like this:

Code: Select all

VERSION BUILD=8920312 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ; 
SET !DATASOURCE c:/datos.csv
SET !LOOP 458
URL GOTO=https://idb14/LectorMySQL/alta_m.php?tabla=Alumnos&ar=ok
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:alta_m_ok.php ATTR=NAME:ApellidoYNombre CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:alta_m_ok.php ATTR=NAME:NroDeDocumento CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:alta_m_ok.php ATTR=NAME:Email CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:alta_m_ok.php ATTR=NAME:Nacionalidad CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:alta_m_ok.php ATTR=NAME:PaisDeOrigen CONTENT={{!COL5}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:alta_m_ok.php ATTR=NAME:LugarDeTrabajo CONTENT={{!COL6}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:alta_m_ok.php ATTR=NAME:Submit
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ACTION:AltaConfirmacion.php ATTR=NAME:Submit
WAIT SECONDS=1
I made it a few years ago, and still works like a charm on this config:

Code: Select all

Windows 7, Firefox: 49.0.2, iMacros 9.0.3
(see @chivracq I know what FCI is :lol: )

but I cannot make it run in:

Code: Select all

debian 9, firefox 49.0b, iMacros 9.0.3
off course that I changed the path of the file for a valid one, (like: /media/alejandro/WinDrive/datos.csv) and that doesn't seem to be the problem.

When I run this script in linux in slow mode, it goes ok until first TAG line and I get:

Code: Select all

this.dataSource[(line - 1)] is undefined, line: 7 (Error code: -1001)
Yeah...!, very good about FCI, ah-ah...! :D

But..., yeah, the "c:/datos.csv" (or "c:\datos.csv") is a Windows specific Path, I would think... You need to adapt it to the Linux File System..., or to make sure your DataSource is located in the Default 'DataSources' Folder, and you then don't need to specify its full Path...
Hum, and even on Win-OS, Win7 was maybe the last Windows Version to allow Browsers and Add-ons to "access" a File located on the 'C:\' Root, I think...
- (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...
alete
Posts: 13
Joined: Sun Sep 07, 2014 11:03 pm

Re: Cannot run in linux, a iim script running on windows

Post by alete » Mon Oct 01, 2018 8:14 pm

chivracq wrote:
alete wrote: When I run this script in linux in slow mode, it goes ok until first TAG line and I get:

Code: Select all

this.dataSource[(line - 1)] is undefined, line: 7 (Error code: -1001)
Yeah...!, very good about FCI, ah-ah...! :D

But..., yeah, the "c:/datos.csv" (or "c:\datos.csv") is a Windows specific Path, I would think... You need to adapt it to the Linux File System..., or to make sure your DataSource is located in the Default 'DataSources' Folder, and you then don't need to specify its full Path...
Hum, and even on Win-OS, Win7 was maybe the last Windows Version to allow Browsers and Add-ons to "access" a File located on the 'C:\' Root, I think...
Hum... both linux full path (/media/alejandro/WinDrive/datos.csv) or setting /media/alejandro/WinDrive as the default DataSources folder and then using just

Code: Select all

SET !DATASOURCE datos.csv
give me the same result as before

Code: Select all

this.dataSource[(line - 1)] is undefined, line: 7 (Error code: -1001)
could it be something related to codification? My windows locale is spanish-argentina and in linux it is en-US. I setted the

Code: Select all

SET !DATASOURCE_DELIMITER ; 
anyway
chivracq
Posts: 8217
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Cannot run in linux, a iim script running on windows

Post by chivracq » Mon Oct 01, 2018 8:26 pm

alete wrote:Hum... both linux full path (/media/alejandro/WinDrive/datos.csv) or setting /media/alejandro/WinDrive as the default DataSources folder and then using just

Code: Select all

SET !DATASOURCE datos.csv
give me the same result as before

Code: Select all

this.dataSource[(line - 1)] is undefined, line: 7 (Error code: -1001)
could it be something related to codification? My windows locale is spanish-argentina and in linux it is en-US. I setted the

Code: Select all

SET !DATASOURCE_DELIMITER ; 
anyway
Oh...!, but wait, the RuntimeError is related to Line 7 where you use '!COLn' for the first time and is related to:

Code: Select all

this.dataSource[(line - 1)] is undefined, line: 7 (Error code: -1001)
=> Yep, you need to use the '!DATASOURCE_LINE' Command..., which apparently can be omitted in iMacros for FF on Win-OS, but might still be required on Linux, just like the '!DATASOURCE_COLUMNS' Command which I think is now only needed on CR... :idea:
- (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...
alete
Posts: 13
Joined: Sun Sep 07, 2014 11:03 pm

Re: Cannot run in linux, a iim script running on windows

Post by alete » Wed Oct 03, 2018 12:58 pm

chivracq wrote:
alete wrote:Hum... both linux full path (/media/alejandro/WinDrive/datos.csv) or setting /media/alejandro/WinDrive as the default DataSources folder and then using just

Code: Select all

SET !DATASOURCE datos.csv
give me the same result as before

Code: Select all

this.dataSource[(line - 1)] is undefined, line: 7 (Error code: -1001)
could it be something related to codification? My windows locale is spanish-argentina and in linux it is en-US. I setted the

Code: Select all

SET !DATASOURCE_DELIMITER ; 
anyway
Oh...!, but wait, the RuntimeError is related to Line 7 where you use '!COLn' for the first time and is related to:

Code: Select all

this.dataSource[(line - 1)] is undefined, line: 7 (Error code: -1001)
=> Yep, you need to use the '!DATASOURCE_LINE' Command..., which apparently can be omitted in iMacros for FF on Win-OS, but might still be required on Linux, just like the '!DATASOURCE_COLUMNS' Command which I think is now only needed on CR... :idea:
You mean like this?

Code: Select all

VERSION BUILD=8920312 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ; 
SET !DATASOURCE datos.csv
SET !LOOP 458
SET !DATASOURCE_LINE {{!LOOP}}
this throws error on !DATASOURCE_LINE line:

Code: Select all

Invalid DATASOURCE_LINE value: 458, line: 6 (Error code: -951)
where 458 is the first row I want to start looping.
chivracq
Posts: 8217
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Cannot run in linux, a iim script running on windows

Post by chivracq » Wed Oct 03, 2018 7:30 pm

alete wrote:You mean like this?

Code: Select all

VERSION BUILD=8920312 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ; 
SET !DATASOURCE datos.csv
SET !LOOP 458
SET !DATASOURCE_LINE {{!LOOP}}
this throws error on !DATASOURCE_LINE line:

Code: Select all

Invalid DATASOURCE_LINE value: 458, line: 6 (Error code: -951)
where 458 is the first row I want to start looping.
Yep.... this now looks correct..., and you need (of course...!) to specify a Nb >=458 in the 'Loop_Max' Field...
=> Specify "460" for example, if you intend to loop your Script x3 times...

But hum..., even if you had only set "3" in the 'Loop_Max' Field, your Macro should still finish one Run... :?

Either your Row_458 doesn't exist in your '.CSV' DataSource...!, or you might be encountering a Character Encoding Pb if your '.CSV' came from some Win System... => Try re-saving your '.CSV' "locally" on Linux using some Text Editor, and select 'UTF-8 (with BOM)' as Charset Encoding... :idea:
- (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...
alete
Posts: 13
Joined: Sun Sep 07, 2014 11:03 pm

Re: Cannot run in linux, a iim script running on windows

Post by alete » Fri Oct 05, 2018 4:07 pm

chivracq wrote:
alete wrote:You mean like this?

Code: Select all

VERSION BUILD=8920312 RECORDER=FX
TAB T=1
SET !DATASOURCE_DELIMITER ; 
SET !DATASOURCE datos.csv
SET !LOOP 458
SET !DATASOURCE_LINE {{!LOOP}}
this throws error on !DATASOURCE_LINE line:

Code: Select all

Invalid DATASOURCE_LINE value: 458, line: 6 (Error code: -951)
where 458 is the first row I want to start looping.
Yep.... this now looks correct..., and you need (of course...!) to specify a Nb >=458 in the 'Loop_Max' Field...
=> Specify "460" for example, if you intend to loop your Script x3 times...

But hum..., even if you had only set "3" in the 'Loop_Max' Field, your Macro should still finish one Run... :?

Either your Row_458 doesn't exist in your '.CSV' DataSource...!, or you might be encountering a Character Encoding Pb if your '.CSV' came from some Win System... => Try re-saving your '.CSV' "locally" on Linux using some Text Editor, and select 'UTF-8 (with BOM)' as Charset Encoding... :idea:
chivracq, you are the man! :mrgreen:

The solution was re-saving the .csv in linux with UTF-8 and unix-like line format. THANKS!!! :mrgreen:
chivracq
Posts: 8217
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Cannot run in linux, a iim script running on windows

Post by chivracq » Sat Oct 06, 2018 5:23 pm

alete wrote:chivracq, you are the man! :mrgreen:

The solution was re-saving the .csv in linux with UTF-8 and unix-like line format. THANKS!!! :mrgreen:
Okay...!, glad it worked then, ah-ah...! :D
- (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...
Post Reply