Problem when loop Javascript in imacros

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.

Problem when loop Javascript in imacros

by krkannan94 on Thu May 25, 2017 1:03 am

Hi bros :) i'm new here, first of all English isn’t my first language, so please excuse any mistakes :D
I'm using iMacros v9.0.3 on Firefox 53.0.3 (64 bit) in Windows 8 x64
i'm trying to loop the javascript code in imacros with a datasource, its working fine on when its just iim code, it perfectly enters the respected row value on based on loop no's but after i convert the script from iim into javascript it doesn't loop correctly

for eg, in iim code when i loop, it rightly enters row by row data
loop1 - kannan1
loop2 - kannan2
loop3 - kannan3 ...

but after i convert into javascript it always loop only the 1st row over and over again :(
loop1 - kannan1
loop2 - kannan1
loop3 - kannan1 ..

Here is my Datasource demo.csv


Here is an iim example code :
Code: Select all
 VERSION BUILD=9030808 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
SET !DATASOURCE demo.csv
SET !DATASOURCE_COLUMNS 8
URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:fname CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:lname CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:city CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:zip CONTENT={{!COL5}}
TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:state CONTENT=%IN
TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:country CONTENT=%73
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:email CONTENT={{!COL8}}
TAG POS=1 TYPE=BUTTON FORM=ID:demo ATTR=TXT:Submit


Here is an javascript example code :
Code: Select all
 var macro;
macro =  "CODE:";
for(var X = 1; X <= 10; X++)
{

macro +=  "TAB T=1" + "\n";
macro +=  "TAB CLOSEALLOTHERS" + "\n";
macro +=  "SET !DATASOURCE demo.csv" + "\n";
macro +=  "SET !DATASOURCE_COLUMNS 8" + "\n";
macro +=  "URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry" + "\n";
macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:fname CONTENT={{!COL1}}" + "\n";
macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:lname CONTENT={{!COL2}}" + "\n";
macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT={{!COL3}}" + "\n";
macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:city CONTENT={{!COL4}}" + "\n";
macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:zip CONTENT={{!COL5}}" + "\n";
macro +=  "TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:state CONTENT=%IN" + "\n";
macro +=  "TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:country CONTENT=%73" + "\n";
macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:email CONTENT={{!COL8}}" + "\n";
macro +=  "TAG POS=1 TYPE=BUTTON FORM=ID:demo ATTR=TXT:Submit" + "\n";
iimPlay(macro)

}
iimPlay(macro)


Any ideas in how to make it loop correctly :) and thx in advance to all my brothers :D :D
Last edited by krkannan94 on Wed Jun 07, 2017 9:37 am, edited 4 times in total.
krkannan94
 
Posts: 24
Joined: Wed May 24, 2017 10:04 pm

Re: Problem when loop Javascript in imacros

by chivracq on Thu May 25, 2017 2:03 am

krkannan94 wrote:Hi bros :) i'm new here, first of all English isn’t my first language, so please excuse any mistakes :D
i'm trying to loop the javascript code in imacros with a datasource, its working fine on when its just iim code, it perfectly enters the respected row value on based on loop no's but after i convert the script from iim into javascript it doesn't loop correctly

for eg, in iim code when i loop, it rightly enters row by row data
loop1 - kannan1
loop2 - kannan2
loop3 - kannan3 ...

but after i convert into javascript it always loop only the 1st row over and over again :(
loop1 - kannan1
loop2 - kannan1
loop3 - kannan1 ..

Here is my Datasource demo.csv


Here is an iim example code :
Code: Select all
 VERSION BUILD=9030808 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
SET !DATASOURCE demo.csv
SET !DATASOURCE_COLUMNS 8
URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:fname CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:lname CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:city CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:zip CONTENT={{!COL5}}
TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:state CONTENT=%IN
TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:country CONTENT=%73
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:email CONTENT={{!COL8}}
TAG POS=1 TYPE=BUTTON FORM=ID:demo ATTR=TXT:Submit


Here is an javascript example code :
Code: Select all
 var macro;
macro =  "CODE:";
for(var X = 1; X <= 10; X++)
{

macro +=  "TAB T=1" + "\n";
macro +=  "TAB CLOSEALLOTHERS" + "\n";
macro +=  "SET !DATASOURCE demo.csv" + "\n";
macro +=  "SET !DATASOURCE_COLUMNS 8" + "\n";
macro +=  "URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry" + "\n";
macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:fname CONTENT={{!COL1}}" + "\n";
macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:lname CONTENT={{!COL2}}" + "\n";
macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT={{!COL3}}" + "\n";
macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:city CONTENT={{!COL4}}" + "\n";
macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:zip CONTENT={{!COL5}}" + "\n";
macro +=  "TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:state CONTENT=%IN" + "\n";
macro +=  "TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:country CONTENT=%73" + "\n";
macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:email CONTENT={{!COL8}}" + "\n";
macro +=  "TAG POS=1 TYPE=BUTTON FORM=ID:demo ATTR=TXT:Submit" + "\n";
iimPlay(macro)

}
iimPlay(macro)


Any ideas in how to make it loop correctly :) and thx in advance to all my brothers :D :D

Hum..., nice Effort put in your Post, with Script(s) to reproduce the Pb, and even Test '.CSV' provided, very good...! :D
But...: FCIM...! :mrgreen: (Read my Sig...)
=> iMacros for FF v9.0.3, FF53...?, OS...?

Euh..., yep, you need to tell your Script which '!DATASOURCE_LINE' to use, based on '!LOOP' or your own Loop..., but even if you use '!LOOP', you need to handle the Looping yourself.
I'm nearly surprised your '.iim' Script works as you say, without defining '!DATASOURCE_LINE' as well, but maybe that's the Default Behaviour, I actually never tried without...
- (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: 5980
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Problem when loop Javascript in imacros

by krkannan94 on Thu May 25, 2017 2:47 am

chivracq wrote:Hum..., nice Effort put in your Post, with Script(s) to reproduce the Pb, and even Test '.CSV' provided, very good...! :D
But...: FCIM...! :mrgreen: (Read my Sig...)
=> iMacros for FF v9.0.3, FF53...?, OS...?

Euh..., yep, you need to tell your Script which '!DATASOURCE_LINE' to use, based on '!LOOP' or your own Loop..., but even if you use '!LOOP', you need to handle the Looping yourself.
I'm nearly surprised your '.iim' Script works as you say, without defining '!DATASOURCE_LINE' as well, but maybe that's the Default Behaviour, I actually never tried without...


:( :( :( Sorry bro for FCIM !

I use iMacros for FF 9.0.3., Firefox 53.0.3 (64bit) and Windows 8 x64
krkannan94
 
Posts: 24
Joined: Wed May 24, 2017 10:04 pm

Re: Problem when loop Javascript in imacros

by krkannan94 on Tue May 30, 2017 9:30 pm

Hum..., nice Effort put in your Post, with Script(s) to reproduce the Pb, and even Test '.CSV' provided, very good...! :D
But...: FCIM...! :mrgreen: (Read my Sig...)
=> iMacros for FF v9.0.3, FF53...?, OS...?

Euh..., yep, you need to tell your Script which '!DATASOURCE_LINE' to use, based on '!LOOP' or your own Loop..., but even if you use '!LOOP', you need to handle the Looping yourself.
I'm nearly surprised your '.iim' Script works as you say, without defining '!DATASOURCE_LINE' as well, but maybe that's the Default Behaviour, I actually never tried without...



i don't know whether i have changed the code correctly or not as u mentioned but i add the line !Datasource and !LOOP but nothing changed still it loops the first value only over and over again :( anyway thanks for your valuable reply bro :)

Code: Select all
var macro;
macro =  "CODE:";
for(var X = 1; X <= 10; X++){

  macro +=  "TAB T=1" + "\n";
  macro +=  "TAB CLOSEALLOTHERS" + "\n";
  macro +=  "SET !DATASOURCE demo.csv" + "\n";
  macro +=  "SET !DATASOURCE_COLUMNS 8" + "\n";
  macro +=  "SET !DATASOURCE_LINE {{!LOOP}} " + "\n";
  macro +=  "SET !LOOP 1" + "\n"
  macro +=  "URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:fname CONTENT={{!COL1}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:lname CONTENT={{!COL2}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT={{!COL3}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:city CONTENT={{!COL4}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:zip CONTENT={{!COL5}}" + "\n";
  macro +=  "TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:state CONTENT=%IN" + "\n";
  macro +=  "TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:country CONTENT=%73" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:email CONTENT={{!COL8}}" + "\n";
  macro +=  "TAG POS=1 TYPE=BUTTON FORM=ID:demo ATTR=TXT:Submit" + "\n";
  iimPlay(macro)

}
iimPlay(macro)
krkannan94
 
Posts: 24
Joined: Wed May 24, 2017 10:04 pm

Re: Problem when loop Javascript in imacros

by chivracq on Wed May 31, 2017 6:28 am

krkannan94 wrote:i don't know whether i have changed the code correctly or not as u mentioned but i add the line !Datasource and !LOOP but nothing changed still it loops the first value only over and over again :( anyway thanks for your valuable reply bro :)

Code: Select all
var macro;
macro =  "CODE:";
for(var X = 1; X <= 10; X++){

  macro +=  "TAB T=1" + "\n";
  macro +=  "TAB CLOSEALLOTHERS" + "\n";
  macro +=  "SET !DATASOURCE demo.csv" + "\n";
  macro +=  "SET !DATASOURCE_COLUMNS 8" + "\n";
  macro +=  "SET !DATASOURCE_LINE {{!LOOP}} " + "\n";
  macro +=  "SET !LOOP 1" + "\n"
  macro +=  "URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:fname CONTENT={{!COL1}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:lname CONTENT={{!COL2}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT={{!COL3}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:city CONTENT={{!COL4}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:zip CONTENT={{!COL5}}" + "\n";
  macro +=  "TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:state CONTENT=%IN" + "\n";
  macro +=  "TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:country CONTENT=%73" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:email CONTENT={{!COL8}}" + "\n";
  macro +=  "TAG POS=1 TYPE=BUTTON FORM=ID:demo ATTR=TXT:Submit" + "\n";
  iimPlay(macro)

}
iimPlay(macro)

Euh..., yep, but that's because like I said, you need to handle the Looping yourself from your '.js' Script (with 'iimSet()'), you cannot really use the Built-in '!LOOP' Var...
Each time your 'iimPlay(macro)' is "fired", your 'macro' '.iim' Macro is dynamically generated on the fly and run, but it doesn't "know" anything about what "happened" before, so you need to "tell" it in which Loop Number it is already.
- (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: 5980
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Problem when loop Javascript in imacros

by krkannan94 on Wed May 31, 2017 9:12 am

Euh..., yep, but that's because like I said, you need to handle the Looping yourself from your '.js' Script (with 'iimSet()'), you cannot really use the Built-in '!LOOP' Var...
Each time your 'iimPlay(macro)' is "fired", your 'macro' '.iim' Macro is dynamically generated on the fly and run, but it doesn't "know" anything about what "happened" before, so you need to "tell" it in which Loop Number it is already.


basically i'm not a code writer or much knowledge in javascript so I don't know how to use iimset() in JavaScript :( if you are free and you have time could you please write this code for me and thanks in adv bro :) :)
krkannan94
 
Posts: 24
Joined: Wed May 24, 2017 10:04 pm

Re: Problem when loop Javascript in imacros

by chivracq on Wed May 31, 2017 1:12 pm

krkannan94 wrote:
Euh..., yep, but that's because like I said, you need to handle the Looping yourself from your '.js' Script (with 'iimSet()'), you cannot really use the Built-in '!LOOP' Var...
Each time your 'iimPlay(macro)' is "fired", your 'macro' '.iim' Macro is dynamically generated on the fly and run, but it doesn't "know" anything about what "happened" before, so you need to "tell" it in which Loop Number it is already.


basically i'm not a code writer or much knowledge in javascript so I don't know how to use iimset() in JavaScript :( if you are free and you have time could you please write this code for me and thanks in adv bro :) :)

Ah-ah...!, nice try, but: Out of luck, oops...!, sorry...! :lol:

I don't do '.js' Scripts as I don't use them myself at all for my own Macros, and you don't need any '.js' Script for your Case. It is much simpler to use an '.iim' Script for your Case and to use the Built-in '!LOOP' Mechanism... If you decide to go for the more complicated and cumbersome '.js' Script, then you must be able to handle all parts by yourself, I would think... If you want to reinvent the Wheel, then go ahead...! :wink:

But check the Wiki and the Forum, you'll find many Examples of how to use 'iimSet()' to pass a Var from your main '.js' Script to your on-the-fly '.iim' Macro to handle the Looping if you prefer to stick to this way... :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...
chivracq
 
Posts: 5980
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Problem when loop Javascript in imacros

by krkannan94 on Thu Jun 01, 2017 12:22 am

Ah-ah...!, nice try, but: Out of luck, oops...!, sorry...! :lol:

I don't do '.js' Scripts as I don't use them myself at all for my own Macros, and you don't need any '.js' Script for your Case. It is much simpler to use an '.iim' Script for your Case and to use the Built-in '!LOOP' Mechanism... If you decide to go for the more complicated and cumbersome '.js' Script, then you must be able to handle all parts by yourself, I would think... If you want to reinvent the Wheel, then go ahead...! :wink:

But check the Wiki and the Forum, you'll find many Examples of how to use 'iimSet()' to pass a Var from your main '.js' Script to your on-the-fly '.iim' Macro to handle the Looping if you prefer to stick to this way... :idea:


i have tried iimset() by see some of the examples but it ends up with error :(
    " ReferenceError: iimplay is not defined, line 13 (Error code: -991) "

Here is an example Code :
Code: Select all
var macro;

for(var X = 1; X <= 10; X++)
  {
  var load;
  load = 'CODE: ';
  load += 'SET !DATASOURCE C:\Users\Kannan\Documents\iMacros\Datasources\demo.csv' + '\n';
  load += 'SET !DATASOURCE_COLUMNS 8' + '\n';
  iimSet('x', X);
  load += 'SET !DATASOURCE_LINE {{X}}' + '\n';
  load += 'ADD !EXTRACT {{!COL1}}' + '\n';
  var COLUMN1 = iimGetLastExtract(1);
  iimplay(load)
 
  iimplay('CODE:'+'SET !TIMEOUT_PAGE 100'+'\nURL GOTO=http://demo.imacros.net/Automate/AutoDataEntry');
  iimSet('column1',COLUMN1)
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:fname CONTENT={{!COL1}}');
  iimSet('column2',COLUMN2)
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:lname CONTENT={{!COL2}}');
  iimSet('column3',COLUMN3)
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT={{!COL3}}');
  iimSet('column4',COLUMN4)
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:city CONTENT={{!COL4}}');
 
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:state CONTENT=%IN');
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:country CONTENT=%73');
 
  iimSet('column8',COLUMN8)
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:email CONTENT={{!COL8}}');
 
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=BUTTON FORM=ID:demo ATTR=TXT:Submit');

}


and Thank you very much bro your support is greatly appreciated <3 <3 <3 <3 <3 <3 have a nice day
krkannan94
 
Posts: 24
Joined: Wed May 24, 2017 10:04 pm

Re: Problem when loop Javascript in imacros

by chivracq on Thu Jun 01, 2017 8:00 am

krkannan94 wrote:i have tried iimset() by see some of the examples but it ends up with error :(
    " ReferenceError: iimplay is not defined, line 13 (Error code: -991) "

Here is an example Code :
Code: Select all
var macro;

for(var X = 1; X <= 10; X++)
  {
  var load;
  load = 'CODE: ';
  load += 'SET !DATASOURCE C:\Users\Kannan\Documents\iMacros\Datasources\demo.csv' + '\n';
  load += 'SET !DATASOURCE_COLUMNS 8' + '\n';
  iimSet('x', X);
  load += 'SET !DATASOURCE_LINE {{X}}' + '\n';
  load += 'ADD !EXTRACT {{!COL1}}' + '\n';
  var COLUMN1 = iimGetLastExtract(1);
  iimplay(load)
 
  iimplay('CODE:'+'SET !TIMEOUT_PAGE 100'+'\nURL GOTO=http://demo.imacros.net/Automate/AutoDataEntry');
  iimSet('column1',COLUMN1)
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:fname CONTENT={{!COL1}}');
  iimSet('column2',COLUMN2)
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:lname CONTENT={{!COL2}}');
  iimSet('column3',COLUMN3)
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT={{!COL3}}');
  iimSet('column4',COLUMN4)
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:city CONTENT={{!COL4}}');
 
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:state CONTENT=%IN');
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:country CONTENT=%73');
 
  iimSet('column8',COLUMN8)
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:email CONTENT={{!COL8}}');
 
  iimplay('CODE:'+'SET !TIMEOUT_STEP 0'+'\nTAG POS=1 TYPE=BUTTON FORM=ID:demo ATTR=TXT:Submit');

}


and Thank you very much bro your support is greatly appreciated <3 <3 <3 <3 <3 <3 have a nice day

Well, JavaScript Commands are Case Sensitive, I reckon "iimplay()" <> "iimPlay()"...!

And hum, the way you try to use 'iimSet()' for each Column will not work the way you try to implement it... You are again "trying to reinvent the Wheel", ah-ah...!, let iMacros do "its Job" with the Built-in '!COLn' Mechanism, it works already perfectly... :roll:
What you need to handle yourself with 'iimSet()' and passing a Var is the "Looping" for the Rows, not fetching the Data Col by Col.
And "Looping" = '!DATASOURCE_LINE'...!
- (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: 5980
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Problem when loop Javascript in imacros

by krkannan94 on Sat Jun 03, 2017 11:11 am

Well, JavaScript Commands are Case Sensitive, I reckon "iimplay()" <> "iimPlay()"...!

And hum, the way you try to use 'iimSet()' for each Column will not work the way you try to implement it... You are again "trying to reinvent the Wheel", ah-ah...!, let iMacros do "its Job" with the Built-in '!COLn' Mechanism, it works already perfectly... :roll:
What you need to handle yourself with 'iimSet()' and passing a Var is the "Looping" for the Rows, not fetching the Data Col by Col.
And "Looping" = '!DATASOURCE_LINE'...!


thanks for your support bro :) :) :) :) :) finally the script is working fine

Code: Select all
var macro;
macro =  "CODE:";
  macro +=  "TAB T=1" + "\n";
  macro +=  "TAB CLOSEALLOTHERS" + "\n";
  macro +=  "SET !DATASOURCE demo.csv" + "\n";
  macro +=  "SET !DATASOURCE_COLUMNS 8" + "\n";
  macro +=  "SET !DATASOURCE_LINE {{i}} " + "\n";
  macro +=  "SET !LOOP 1" + "\n"
  macro +=  "URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:fname CONTENT={{!COL1}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:lname CONTENT={{!COL2}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT={{!COL3}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:city CONTENT={{!COL4}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:zip CONTENT={{!COL5}}" + "\n";
  macro +=  "TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:state CONTENT=%IN" + "\n";
  macro +=  "TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:country CONTENT=%73" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:email CONTENT={{!COL8}}" + "\n";
  macro +=  "TAG POS=1 TYPE=BUTTON FORM=ID:demo ATTR=TXT:Submit" + "\n";
for (var i=1;i<10;i++)
Last edited by krkannan94 on Wed Jun 07, 2017 9:36 am, edited 1 time in total.
krkannan94
 
Posts: 24
Joined: Wed May 24, 2017 10:04 pm

Re: Problem when loop Javascript in imacros

by chivracq on Sat Jun 03, 2017 1:31 pm

krkannan94 wrote:
Well, JavaScript Commands are Case Sensitive, I reckon "iimplay()" <> "iimPlay()"...!

And hum, the way you try to use 'iimSet()' for each Column will not work the way you try to implement it... You are again "trying to reinvent the Wheel", ah-ah...!, let iMacros do "its Job" with the Built-in '!COLn' Mechanism, it works already perfectly... :roll:
What you need to handle yourself with 'iimSet()' and passing a Var is the "Looping" for the Rows, not fetching the Data Col by Col.
And "Looping" = '!DATASOURCE_LINE'...!


thanks for your support bro :) :) :) :) :) finally the script is working fine

Code: Select all
var macro;
macro =  "CODE:";
  macro +=  "TAB T=1" + "\n";
  macro +=  "TAB CLOSEALLOTHERS" + "\n";
  macro +=  "SET !DATASOURCE demo.csv" + "\n";
  macro +=  "SET !DATASOURCE_COLUMNS 8" + "\n";
  macro +=  "SET !DATASOURCE_LINE {{i}} " + "\n";
  macro +=  "SET !LOOP 1" + "\n"
  macro +=  "URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:fname CONTENT={{!COL1}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:lname CONTENT={{!COL2}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:address CONTENT={{!COL3}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:city CONTENT={{!COL4}}" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:zip CONTENT={{!COL5}}" + "\n";
  macro +=  "TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:state CONTENT=%IN" + "\n";
  macro +=  "TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=ID:country CONTENT=%73" + "\n";
  macro +=  "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=ID:email CONTENT={{!COL8}}" + "\n";
  macro +=  "TAG POS=1 TYPE=BUTTON FORM=ID:demo ATTR=TXT:Submit" + "\n";
for (var i=1;i<10;i++)
{
iimSet("i",i)
iimPlay(macro)
}

Yep..., very good...!, "iimPlay()" spelt correctly (case-wise...) and passing your "i" Var to use for '!DATASOURCE_LINE', perfect...!
And thanks for sharing... (for other Users, ah-ah...!)

Nice helping you, you are a quick Learner and you do your best to find the Solution by yourself, Big Compliment...!, I rarely write Scripts for other Users, unless I don't have much time and it will take me 3 min to write a Script while it might take 20 Posts until the User will understand what they do "wrong", I prefer to let you find the final Solution by yourself, but hum, my 'Method" obviously doesn't work with "everybody", oooooops...!

But, hum, still concerning this specific Thread, you didn't need any '.js' Script at all, your Sol is still a bit cumbersome, would have been much easier in pure '.iim'..., just saying...! :oops:
- (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: 5980
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Problem when loop Javascript in imacros

by krkannan94 on Sat Jun 03, 2017 9:28 pm

But, hum, still concerning this specific Thread, you didn't need any '.js' Script at all, your Sol is still a bit cumbersome, would have been much easier in pure '.iim'..., just saying...! :oops:


bcoz I need to protect it(obfuscate) so nobody can edit it or know what the source is :mrgreen: :mrgreen: :mrgreen: & thx for your great support bro

Image
krkannan94
 
Posts: 24
Joined: Wed May 24, 2017 10:04 pm

Re: Problem when loop Javascript in imacros

by chivracq on Sun Jun 04, 2017 4:43 pm

krkannan94 wrote:
But, hum, still concerning this specific Thread, you didn't need any '.js' Script at all, your Sol is still a bit cumbersome, would have been much easier in pure '.iim'..., just saying...! :oops:


bcoz I need to protect it(obfuscate) so nobody can edit it or know what the source is :mrgreen: :mrgreen: :mrgreen: & thx for your great support bro

Yeah..., obfuscating in this way will maybe work with VERY-VERY un-technical Users, ah-ah...!, but OK, live your Dream, re-ah-ah...!

Why do you want btw to "obfuscate" some Script that you get yourself to work for FREE from a Forum...? Sorry but I don't get it... :shock:
(Hum, and answer this Qt a bit "correctly", I help Users for Free all the time, I don't like "Obfuscating" or whatever in this "Direction", iMacros (for FF) is for FREE and Open-Source, WTF do you need to "obfuscate"...!?, or I won't try to help you again in the Future...)
- (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: 5980
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Re: Problem when loop Javascript in imacros

by krkannan94 on Sun Jun 04, 2017 10:08 pm

Why do you want btw to "obfuscate" some Script that you get yourself to work for FREE from a Forum...? Sorry but I don't get it... :shock:
(Hum, and answer this Qt a bit "correctly", I help Users for Free all the time, I don't like "Obfuscating" or whatever in this "Direction", iMacros (for FF) is for FREE and Open-Source, WTF do you need to "obfuscate"...!?


I would like to share my work with the group, but the strangers use my work against me because some in the group are openly sharing my work that's why i need to obfuscate them

I won't try to help you again in the Future...)


That's OK it's your wish, but once again thanks for your friendliness and quick reply :) have a nice day
Last edited by krkannan94 on Tue Jun 06, 2017 6:10 am, edited 1 time in total.
krkannan94
 
Posts: 24
Joined: Wed May 24, 2017 10:04 pm

Re: Problem when loop Javascript in imacros

by chivracq on Mon Jun 05, 2017 5:38 am

krkannan94 wrote:
Why do you want btw to "obfuscate" some Script that you get yourself to work for FREE from a Forum...? Sorry but I don't get it... :shock:
(Hum, and answer this Qt a bit "correctly", I help Users for Free all the time, I don't like "Obfuscating" or whatever in this "Direction", iMacros (for FF) is for FREE and Open-Source, WTF do you need to "obfuscate"...!?


I would like to share my work(youtube dislikes) with the group, but the strangers use my work against me because some in the group are openly sharing my work that's why i need to obfuscate them

I won't try to help you again in the Future...)


That's OK it's your wish, but once again thanks for your friendliness and quick reply :) have a nice day

Yeah..., not really convinced, ah-ah...!, there will always be technically more advanced Users than you in your Group who will be able to "de-obfuscate" your Script or simply make their own, so "Security" by "Darkness" has never proven to be very effective, ah-ah...!
And there are already many Scripts being distributed about YT and other popular Sites for Likes/Dislikes/Follow/etc...

I actually usually don't help Users using/misusing iMacros for such Scripts for Social Media (+ Spam + Games/Votes + Hacking/DDos) as I find that it indeed only drives some kind of a "Race" between Users of those Sites and/or their Owners who often are obliged to implement some Captcha Method to prevent Web-Automation which then spreads to more and more Sites and makes it more and more difficult for "legit" Web-Automation on "other" Sites...
- (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: 5980
Joined: Sat Apr 13, 2013 6:07 am
Location: Amsterdam (NL)

Next

Return to iMacros for Firefox

Who is online

Users browsing this forum: No registered users and 12 guests

-->