Problem

Discussions and Tech Support specific to the iMacros Firefox add-on.
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
nemoku
Posts: 26
Joined: Fri Dec 04, 2009 1:50 pm

Problem

Post by nemoku » Tue Jan 12, 2010 8:19 pm

Am using this script for registred + javascript for some fields + csv for info...

Code: Select all

VERSION BUILD=6251204 RECORDER=FX
TAB T=1
        
CMDLINE !DATASOURCE registration.csv
'Number of columns in the CSV file. This must be accurate!
SET !DATASOURCE_LINE 5
'Start at line 2 to skip the header in the file
SET !LOOP 2
'Increase the current position in the file with each loop 
SET !DATASOURCE_LINE {{!LOOP}}
' Fill web form           
        
        
' Start the Registration
TAB OPEN
TAB T=2
        URL GOTO=http://www.prekybostinklas.lt/component/virtuemart/?page=shop.registration&referrer=R-NEMOKU&vmcchk=1
        REFRESH 
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:username_field CONTENT={{!COL1}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:adminForm ATTR=ID:password_field CONTENT={{!password}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:adminForm ATTR=ID:password2_field CONTENT={{!password}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:email_field CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:first_name_field CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:last_name_field CONTENT={{!COL5}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:address_1_field CONTENT={{!COL6}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:city_field CONTENT={{!COL7}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:zip_field CONTENT={{post}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:phone_1_field CONTENT={{phone}}
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:adminForm ATTR=ID:agreed_field CONTENT=YES
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:adminForm ATTR=VALUE:Siųsti<SP>Registraciją
        URL GOTO=http://www.prekybostinklas.lt
	'CLEAR
WAIT SECONDS=30
CLEAR
But look in the video when the script restart, page wont load... Anyone can recomend me something?

http://www.youtube.com/watch?v=uTzIQ-nm3Bc
nemoku
Posts: 26
Joined: Fri Dec 04, 2009 1:50 pm

Re: Problem

Post by nemoku » Wed Jan 13, 2010 5:18 am

anyone?
Hannes, Tech Support

Re: Problem

Post by Hannes, Tech Support » Wed Jan 13, 2010 8:44 am

Well, the browser's status line says "loading data from ...", so the page not being loaded completely is what makes the macro wait until timeout.

As a workaround, you may use

Code: Select all

SET !TIMEOUT 10
to restrict the macro to 10 seconds of waiting.

Additionally,

Code: Select all

SET !ERRORIGNORE YES 
for that part will make the macro ignore the timeout.
nemoku
Posts: 26
Joined: Fri Dec 04, 2009 1:50 pm

Re: Problem

Post by nemoku » Wed Jan 13, 2010 12:18 pm

Thanks, but another problem..


Trying to run .js with loop.. But i wont run.. Good i put loop in javascript, but the scritpt after sucefully registration wont take another seeth from .csv file.. I mean.. It's take first seeth, after registartion, do it again.. Taking again Not 2nd but first one..

.js

Code: Select all

const iterations = 5000; // How many times to loop through
const macroName  = 'miteshPrekybosTinklas'; // The name of the macro to launch

/*********************************************************************
            Do not change the code below
*********************************************************************/
var logins = createLogins(iterations); // An Array of random generated Logins
var names = createnames(iterations); // An Array of random generated Name
var passwords = createLogins(iterations); // An Array of random generated Passwords
var emails = createEmails(iterations); // An Array of random generated email addresses
var posts = createPosts(iterations); // An Array of random generated post addresses
var adress = createAdress(iterations); // An Array of random generated post addresses
var phones = createPhones(iterations); // An Array of random generated email phone number.
var poras = createPoras(iterations); // Pora skaiciu.
for( var i=0; i<iterations; i++)
{
   iimSet("login", logins[i]);
   iimSet("names", names[i]);
   iimSet("adres", adress[i]);
   iimSet("email", emails[i]);
   iimSet("phone", phones[i]);
   iimSet("post", posts[i]);
      iimSet("pora", poras[i]);
   iimSet("password", passwords[i]);
   iimPlay(macroName);
}

// Telefonas
function createPhones(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = '+3706' + generateRandomStrings(7, 8);
   
   return returnValue;
}

// Vardas
function createnames(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = 'Tomas' + generateRandomStrings(3, 4);
   
   return returnValue;
}

//  Adresas
function createAdress(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = 'Kalnieciu' + ' ' + generateRandomStrings(2, 3);
   
   return returnValue;
}


// Pašto kodas
function createPosts(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = generateRandomStrings(4, 5);
   
   return returnValue;
}

// Pora skaiciu
function createPoras(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = generateRandomStrings(2, 3);
   
   return returnValue;
}


// Skaitmenys
function generateRandomStrings (minLength, maxLength)
{
   const validCharacters = "0123456789";
   stringLength = generateRandomInteger(minLength, maxLength);
   
   returnValue = '';
   
   for ( var i=0; i< stringLength; i++)
      returnValue += validCharacters.charAt(generateRandomInteger(0, validCharacters.length -2));
   
   return returnValue;
}

// Loginas
function createLogins(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = generateRandomString(6, 16);
   
   return returnValue;
}

// Emailas
function createEmails(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = generateRandomString(6, 25) + '@' + 'one.lt';
   
   return returnValue;
}

// Visi
function generateRandomString (minLength, maxLength)
{
   const validCharacters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
   stringLength = generateRandomInteger(minLength, maxLength);
   
   returnValue = '';
   
   for ( var i=0; i< stringLength; i++)
      returnValue += validCharacters.charAt(generateRandomInteger(0, validCharacters.length -1));
   
   return returnValue;
}


// Generate an integer in a given range
function generateRandomInteger(minimum, maximum)
{
   minimum = getValidInteger(minimum, 1);
   maximum = getValidInteger(maximum, minimum + 1);
   return Math.floor(Math.random() * (maximum - minimum)) + minimum;
}


// Make sure we're passing valid integers
function getValidInteger(value, defaultValue)
{
   var returnValue = parseInt(value);
   var defaultValue = parseInt(defaultValue);
   
   if (Number.Nan == defaultValue)
      defaultValue = 0;
      
   return (Number.Nan == returnValue)? defaultValue : returnValue;
}
/*********************************************************************
            Do not change the code above
*********************************************************************/
.iim

Code: Select all

VERSION BUILD=6251204 RECORDER=FX
TAB T=1
        
CMDLINE !DATASOURCE registration.csv
'Number of columns in the CSV file. This must be accurate!
SET !DATASOURCE_COLUMNS 1335
'Start at line 2 to skip the header in the file
SET !LOOP 2
'Increase the current position in the file with each loop 
SET !DATASOURCE_LINE {{!LOOP}}
' Fill web form           
        
        
' Start the Registration
        TAB OPEN
        TAB T=2
        SET !ERRORIGNORE YES 
        SET !TIMEOUT 10
        URL GOTO=http://www.prekybostinklas.lt/component/virtuemart/?page=shop.registration&referrer=R-NEMOKU
                WAIT SECONDS=2
CLICK X=641 Y=439
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:username_field CONTENT={{!COL1}}{{pora}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:adminForm ATTR=ID:password_field CONTENT={!COL2}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:adminForm ATTR=ID:password2_field CONTENT={!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:email_field CONTENT={{pora}}{{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:first_name_field CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:last_name_field CONTENT={{!COL5}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:address_1_field CONTENT={{!COL6}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:city_field CONTENT={{!COL7}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:zip_field CONTENT={{post}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:phone_1_field CONTENT={{phone}}
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:adminForm ATTR=ID:agreed_field CONTENT=YES
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:adminForm ATTR=VALUE:Siųsti<SP>Registraciją
        CLEAR
        URL GOTO=http://www.prekybostinklas.lt/component/virtuemart/?page=shop.registration&referrer=R-NEMOKU
        REFRESH
        WAIT SECONDS=19

And example of seeth..

Image

Very thanks.
Hannes, Tech Support

Re: Problem

Post by Hannes, Tech Support » Wed Jan 13, 2010 1:49 pm

When called via iimPlay(), using !LOOP does not make sense. When the macro is called, it's always "1" as iimPlay() does not run the macro in (macro) loop mode.

Use a self-defined variable like "loopCounter"

in the macro:

Code: Select all

SET !DATASOURCE_LINE {{loopCounter}}
in the script's loop:

Code: Select all

for( var i=0; i<iterations; i++)
{
  '... lots of iimSet() which skipped for brevity, here
  ' ... we'll add one more
   iimSet("loopCounter", ""+i); 'frankly, I'm not sure whether iimSet() expects an int or a string, here
   iimPlay(macroName);
}
nemoku
Posts: 26
Joined: Fri Dec 04, 2009 1:50 pm

Re: Problem

Post by nemoku » Wed Jan 13, 2010 2:20 pm

Can you put it in my code? because am getting error ;D thanks.
Hannes, Tech Support

Re: Problem

Post by Hannes, Tech Support » Wed Jan 13, 2010 2:27 pm

It already was your code, wasn't it?

Code: Select all

for( var i=0; i<iterations; i++)
{
   iimSet("login", logins[i]);
   iimSet("names", names[i]);
   iimSet("adres", adress[i]);
   iimSet("email", emails[i]);
   iimSet("phone", phones[i]);
   iimSet("post", posts[i]);
   iimSet("pora", poras[i]);
   iimSet("password", passwords[i]);
   iimSet("loopCounter", ""+i); 'frankly, I'm not sure whether iimSet() expects an int or a string, here
   iimPlay(macroName);
}
However, the relevant question is: what error do you get?
nemoku
Posts: 26
Joined: Fri Dec 04, 2009 1:50 pm

Re: Problem

Post by nemoku » Wed Jan 13, 2010 3:25 pm

Now code is

Code: Select all

const iterations = 5000; // How many times to loop through
const macroName  = 'miteshPrekybosTinklas'; // The name of the macro to launch

/*********************************************************************
            Do not change the code below
*********************************************************************/
var logins = createLogins(iterations); // An Array of random generated Logins
var names = createnames(iterations); // An Array of random generated Name
var passwords = createLogins(iterations); // An Array of random generated Passwords
var emails = createEmails(iterations); // An Array of random generated email addresses
var posts = createPosts(iterations); // An Array of random generated post addresses
var adress = createAdress(iterations); // An Array of random generated post addresses
var phones = createPhones(iterations); // An Array of random generated email phone number.
var poras = createPoras(iterations); // Pora skaiciu.
for( var i=0; i<iterations; i++)
{
   iimSet("login", logins[i]);
   iimSet("names", names[i]);
   iimSet("adres", adress[i]);
   iimSet("email", emails[i]);
   iimSet("phone", phones[i]);
   iimSet("post", posts[i]);
   iimSet("pora", poras[i]);
   iimSet("password", passwords[i]);
   iimSet("loopCounter", ""+i);
   iimPlay(miteshPrekybosTinklas);

// Telefonas
function createPhones(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = '+3706' + generateRandomStrings(7, 8);
   
   return returnValue;
}

// Vardas
function createnames(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = 'Tomas' + generateRandomStrings(3, 4);
   
   return returnValue;
}

//  Adresas
function createAdress(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = 'Kalnieciu' + ' ' + generateRandomStrings(2, 3);
   
   return returnValue;
}


// Pašto kodas
function createPosts(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = generateRandomStrings(4, 5);
   
   return returnValue;
}

// Pora skaiciu
function createPoras(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = generateRandomStrings(2, 3);
   
   return returnValue;
}


// Skaitmenys
function generateRandomStrings (minLength, maxLength)
{
   const validCharacters = "0123456789";
   stringLength = generateRandomInteger(minLength, maxLength);
   
   returnValue = '';
   
   for ( var i=0; i< stringLength; i++)
      returnValue += validCharacters.charAt(generateRandomInteger(0, validCharacters.length -2));
   
   return returnValue;
}

// Loginas
function createLogins(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = generateRandomString(6, 16);
   
   return returnValue;
}

// Emailas
function createEmails(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = generateRandomString(6, 25) + '@' + 'one.lt';
   
   return returnValue;
}

// Visi
function generateRandomString (minLength, maxLength)
{
   const validCharacters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
   stringLength = generateRandomInteger(minLength, maxLength);
   
   returnValue = '';
   
   for ( var i=0; i< stringLength; i++)
      returnValue += validCharacters.charAt(generateRandomInteger(0, validCharacters.length -1));
   
   return returnValue;
}

// Generate an integer in a given range
function generateRandomInteger(minimum, maximum)
{
   minimum = getValidInteger(minimum, 1);
   maximum = getValidInteger(maximum, minimum + 1);
   return Math.floor(Math.random() * (maximum - minimum)) + minimum;
}


// Make sure we're passing valid integers
function getValidInteger(value, defaultValue)
{
   var returnValue = parseInt(value);
   var defaultValue = parseInt(defaultValue);
   
   if (Number.Nan == defaultValue)
      defaultValue = 0;
      
   return (Number.Nan == returnValue)? defaultValue : returnValue;
}
/*********************************************************************
            Do not change the code above
*********************************************************************/ } 
and am getting error.. ReferenceError:
createLogins is not defined, line: 7
and imacros getting this error.
BadParameter: !DATASOURCE_LINE must be positive integer, line: 9

Code:

Code: Select all

VERSION BUILD=6251204 RECORDER=FX
TAB T=1
CMDLINE !DATASOURCE registration.csv
'Number of columns in the CSV file. This must be accurate!
SET !DATASOURCE_COLUMNS 1335
'Start at line 2 to skip the header in the file
SET !LOOP 2
'Increase the current position in the file with each loop 
SET !DATASOURCE_LINE {{loopCounter}}
' Fill web form           
        
        
' Start the Registration
        TAB OPEN
        TAB T=2
        SET !ERRORIGNORE YES 
        SET !TIMEOUT 10
        URL GOTO=http://www.prekybostinklas.lt/component/virtuemart/?page=shop.registration&referrer=R-NEMOKU
                WAIT SECONDS=2
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:username_field CONTENT={{!COL1}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:adminForm ATTR=ID:password_field CONTENT={!COL2}}
SET !ENCRYPTION NO
TAG POS=1 TYPE=INPUT:PASSWORD FORM=NAME:adminForm ATTR=ID:password2_field CONTENT={!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:email_field CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:first_name_field CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:last_name_field CONTENT={{!COL5}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:address_1_field CONTENT={{!COL6}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:city_field CONTENT={{!COL7}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:zip_field CONTENT={{!COL8}}
TAG POS=1 TYPE=INPUT:TEXT FORM=NAME:adminForm ATTR=ID:phone_1_field CONTENT={{!COL9}}
TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:adminForm ATTR=ID:agreed_field CONTENT=YES
TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:adminForm ATTR=VALUE:Siųsti<SP>Registraciją
        CLEAR
        URL GOTO=http://www.prekybostinklas.lt/component/virtuemart/?page=shop.registration&referrer=R-NEMOKU
        REFRESH
        WAIT SECONDS=19
ABooth
Posts: 223
Joined: Mon Aug 10, 2009 4:25 pm

Re: Problem

Post by ABooth » Wed Jan 13, 2010 4:38 pm

To fix

Code: Select all

BadParameter: !DATASOURCE_LINE must be positive integer, line: 9
change:-

Code: Select all

iimSet("loopCounter", ""+i);
to

Code: Select all

iimSet("loopCounter", i + 1);
Your loop goes from 0 to 99 and you can't have a line 0 in your csv file.

The

Code: Select all

createLogins is not defined, line: 7
is probably a syntax error somewhere. It looks like you're missing a curly brace ' } ' in the for loop.

Replace this:-

Code: Select all

for( var i=0; i<iterations; i++)
{
   iimSet("login", logins[i]);
   iimSet("names", names[i]);
   iimSet("adres", adress[i]);
   iimSet("email", emails[i]);
   iimSet("phone", phones[i]);
   iimSet("post", posts[i]);
   iimSet("pora", poras[i]);
   iimSet("password", passwords[i]);
   iimSet("loopCounter", ""+i);
   iimPlay(miteshPrekybosTinklas);

// Telefonas
With this: -

Code: Select all

for( var i=0; i<iterations; i++)
{
   iimSet("login", logins[i]);
   iimSet("names", names[i]);
   iimSet("adres", adress[i]);
   iimSet("email", emails[i]);
   iimSet("phone", phones[i]);
   iimSet("post", posts[i]);
   iimSet("pora", poras[i]);
   iimSet("password", passwords[i]);
   iimSet("loopCounter", i + 1);
   iimPlay(miteshPrekybosTinklas);
}

// Telefonas
iMacros for Firefox supports JavaScript Macros (Scripting)
JavaScript supports Java via LiveConnect

Therefore: You can write powerful macros with iMacros for Firefox. Have a look at this one

Post feature requests here. Maybe one day, they'll pin it?
nemoku
Posts: 26
Joined: Fri Dec 04, 2009 1:50 pm

Re: Problem

Post by nemoku » Wed Jan 13, 2010 6:43 pm

Now just .js showing my this error.

ReferenceError: miteshPrekybosTinklas is not defined, line 26
ABooth
Posts: 223
Joined: Mon Aug 10, 2009 4:25 pm

Re: Problem

Post by ABooth » Wed Jan 13, 2010 10:26 pm

I tested your script and it failed because you used the character in a comment field. This is probably a bug in the iMacros scripting engine.You also added a curly brace { to the end of the script for no reason..

This code worked though

Code: Select all

const iterations = 5000; // How many times to loop through
const macroName  = 'miteshPrekybosTinklas'; // The name of the macro to launch

/*********************************************************************
            Do not change the code below
*********************************************************************/
var logins = createLogins(iterations); // An Array of random generated Logins
var names = createnames(iterations); // An Array of random generated Name
var passwords = createLogins(iterations); // An Array of random generated Passwords
var emails = createEmails(iterations); // An Array of random generated email addresses
var posts = createPosts(iterations); // An Array of random generated post addresses
var adress = createAdress(iterations); // An Array of random generated post addresses
var phones = createPhones(iterations); // An Array of random generated email phone number.
var poras = createPoras(iterations); // Pora skaiciu.

for( var i=0; i<iterations; i++)
{
   iimSet("login", logins[i]);
   iimSet("names", names[i]);
   iimSet("adres", adress[i]);
   iimSet("email", emails[i]);
   iimSet("phone", phones[i]);
   iimSet("post", posts[i]);
   iimSet("pora", poras[i]);
   iimSet("password", passwords[i]);
   iimSet("loopCounter", i + 1);
   iimPlay(miteshPrekybosTinklas);
}

// Telefonas
function createPhones(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = '+3706' + generateRandomStrings(7, 8);
   
   return returnValue;
}

// Vardas
function createnames(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = 'Tomas' + generateRandomStrings(3, 4);
   
   return returnValue;
}

//  Adresas
function createAdress(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = 'Kalnieciu' + ' ' + generateRandomStrings(2, 3);
   
   return returnValue;
}


// Pasto kodas
function createPosts(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = generateRandomStrings(4, 5);
   
   return returnValue;
}

// Pora skaiciu
function createPoras(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = generateRandomStrings(2, 3);
   
   return returnValue;
}


// Skaitmenys
function generateRandomStrings (minLength, maxLength)
{
   const validCharacters = "0123456789";
   stringLength = generateRandomInteger(minLength, maxLength);
   
   returnValue = '';
   
   for ( var i=0; i< stringLength; i++)
      returnValue += validCharacters.charAt(generateRandomInteger(0, validCharacters.length -2));
   
   return returnValue;
}

// Loginas
function createLogins(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = generateRandomString(6, 16);
   
   return returnValue;
}

// Emailas
function createEmails(total)
{
   total = getValidInteger(total, 1);
   
   var returnValue = new Array();
   
   for( var i=0; i<total; i++)
      returnValue[i] = generateRandomString(6, 25) + '@' + 'one.lt';
   
   return returnValue;
}

// Visi
function generateRandomString (minLength, maxLength)
{
   const validCharacters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
   stringLength = generateRandomInteger(minLength, maxLength);
   
   returnValue = '';
   
   for ( var i=0; i< stringLength; i++)
      returnValue += validCharacters.charAt(generateRandomInteger(0, validCharacters.length -1));
   
   return returnValue;
}

// Generate an integer in a given range
function generateRandomInteger(minimum, maximum)
{
   minimum = getValidInteger(minimum, 1);
   maximum = getValidInteger(maximum, minimum + 1);
   return Math.floor(Math.random() * (maximum - minimum)) + minimum;
}


// Make sure we're passing valid integers
function getValidInteger(value, defaultValue)
{
   var returnValue = parseInt(value);
   var defaultValue = parseInt(defaultValue);
   
   if (Number.Nan == defaultValue)
      defaultValue = 0;
     
   return (Number.Nan == returnValue)? defaultValue : returnValue;
}
/*********************************************************************
            Do not change the code above
*********************************************************************/
Note: I changed

Code: Select all

// Pašto kodas
To:-

Code: Select all

// Pasto kodas
š -> s
iMacros for Firefox supports JavaScript Macros (Scripting)
JavaScript supports Java via LiveConnect

Therefore: You can write powerful macros with iMacros for Firefox. Have a look at this one

Post feature requests here. Maybe one day, they'll pin it?
nemoku
Posts: 26
Joined: Fri Dec 04, 2009 1:50 pm

Re: Problem

Post by nemoku » Thu Jan 14, 2010 5:34 am

Geting this

Code: Select all

ReferenceError: miteshPrekybosTinklas is not defined, line 27
Hannes, Tech Support

Re: Problem

Post by Hannes, Tech Support » Thu Jan 14, 2010 6:43 am

nemoku wrote:Geting this

Code: Select all

ReferenceError: miteshPrekybosTinklas is not defined, line 27
You define a string constant

Code: Select all

const macroName  = 'miteshPrekybosTinklas'; // The name of the macro to launch
but in iimPlay() you use

Code: Select all

 iimPlay(miteshPrekybosTinklas);
which is neither a constant/variable name (that's what the error refers to), nor a string (as iimPlay() requires).

So you will need to replace the latter by one of the following:

Code: Select all

 iimPlay(macroName);
or

Code: Select all

 iimPlay("miteshPrekybosTinklas");
ABooth
Posts: 223
Joined: Mon Aug 10, 2009 4:25 pm

Re: Problem

Post by ABooth » Thu Jan 14, 2010 4:31 pm

Good spot.

FYI:-

Code: Select all

// Pašto kodas
does seem to be a bug, where the š causes the script to fail, even though it's in a comment.
iMacros for Firefox supports JavaScript Macros (Scripting)
JavaScript supports Java via LiveConnect

Therefore: You can write powerful macros with iMacros for Firefox. Have a look at this one

Post feature requests here. Maybe one day, they'll pin it?
Hannes, Tech Support

Re: Problem

Post by Hannes, Tech Support » Fri Jan 15, 2010 6:14 am

ABooth wrote: FYI:-

Code: Select all

// Pašto kodas
does seem to be a bug, where the š causes the script to fail, even though it's in a comment.
That would be strange, indeed.
Does the following give you that error, too? Works for me

Code: Select all

// Pašto kodas
iret = iimPlay("#Current") // Pašto kodas
alert ("Done.")
Post Reply