Random Number
Forum rules
iMacros EOL - Attention!
The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely,
The Progress Team
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
iMacros EOL - Attention!
The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.
Thank you again for your business and support.
Sincerely,
The Progress Team
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
Random Number
Is there a way I can make iopus generate a random number (1-99999999999999999999999999999999)
and then make it post it, so it would be like this:
TAG POS=1 TYPE=TEXTAREA FORM=NAME:NoFormName ATTR=ID:Message CONTENT=$randomnumber?
Cheers,
Sam
and then make it post it, so it would be like this:
TAG POS=1 TYPE=TEXTAREA FORM=NAME:NoFormName ATTR=ID:Message CONTENT=$randomnumber?
Cheers,
Sam
- Tech Support
- Posts: 4948
- Joined: Tue Sep 20, 2005 7:25 pm
- Contact:
Re: Random Number
1. If you use the iMacros Scripting Edition please see this VBS script. It does exactly what you need And with iimInit ("-fx") can use Firefox instead of the iMacros Browser.
2. In iMacros for Firefox itself you can use basically the same approach with the Javascript interface.
To generate a random number in JavaScript, simply use the following code:
where 11 dictates that the random number will fall between 0-10. To increase the range to, say, 100, simply change 11 to 101 instead.
Some of you may be curious as to why Math.floor(), instead of Math.round(), is used in the above code. While both successfully round off its containing parameter to an integer within the designated range, Math.floor does so more "evenly", so the resulting integer isn't lopsided towards either end of the number spectrum. In other words, a more random number is returned using Math.floor().
2. In iMacros for Firefox itself you can use basically the same approach with the Javascript interface.
To generate a random number in JavaScript, simply use the following code:
Code: Select all
var randomnumber=Math.floor(Math.random()*11)
Some of you may be curious as to why Math.floor(), instead of Math.round(), is used in the above code. While both successfully round off its containing parameter to an integer within the designated range, Math.floor does so more "evenly", so the resulting integer isn't lopsided towards either end of the number spectrum. In other words, a more random number is returned using Math.floor().
Re: Random Number
Cheers,
but I don't understand how you enter this into an iim, and then post that number into a text box.
Thanks- Sam
but I don't understand how you enter this into an iim, and then post that number into a text box.
Thanks- Sam
-
- Posts: 214
- Joined: Fri Jul 04, 2008 1:28 pm
- Location: Ahmedabad
- Contact:
Re: Random Number
var randomnumber=Math.floor(Math.random()*11)
This will generate random number and assign it to "randomnumber" variable
Now use below command......
iimSet("rnumber", randomnumber);
iimPlay("yourmacro.iim")
Now you can user "rnumber" where you want to use generated random number.
Cheers,
Dharmesh Uteshiya
http://www.dharmesh-uteshiya.co.nr
This will generate random number and assign it to "randomnumber" variable
Now use below command......
iimSet("rnumber", randomnumber);
iimPlay("yourmacro.iim")
Now you can user "rnumber" where you want to use generated random number.
Cheers,
Dharmesh Uteshiya
http://www.dharmesh-uteshiya.co.nr
Dharmendra Uteshiya
http://www.dharmesh-uteshiya.co.nr
http://www.dharmesh-uteshiya.co.nr
Re: Random Number
This doesn't work for me.... I tried using a random code generator site but when I extract the data it adds a space at the end of the code but is there any way I can get rid of the space? I tried using the {BACKSPACE} function but that doesn't workdharmendra2000 wrote:var randomnumber=Math.floor(Math.random()*11)
This will generate random number and assign it to "randomnumber" variable
Now use below command......
iimSet("rnumber", randomnumber);
iimPlay("yourmacro.iim")
Now you can user "rnumber" where you want to use generated random number.
Cheers,
Dharmesh Uteshiya
http://www.dharmesh-uteshiya.co.nr
this is the site http://www.dave-reed.com/Nifty/randSeq.html
Re: Random Number
Hey Dharmesh.dharmendra2000 wrote:var randomnumber=Math.floor(Math.random()*11)
This will generate random number and assign it to "randomnumber" variable
Now use below command......
iimSet("rnumber", randomnumber);
iimPlay("yourmacro.iim")
Now you can user "rnumber" where you want to use generated random number.
Cheers,
Dharmesh Uteshiya
http://www.dharmesh-uteshiya.co.nr
Would this work for the random wait time generator?. If so, how would i edit it, to work and put it into my macro for FF?.
Im trying to get the wait time, to be between 60secs and 400 secs. With a random number between that.
Re: Random Number
Dont works T_T omg...i need help again...
so i creat in FF imacros js file.
In .js file i have this .
omg what i do wrong?
so i creat in FF imacros js file.
In .js file i have this .
So in autoreg.iim i set in reg.form in namevar randomnumber=Math.floor(Math.random()*101)
iimSet("rnumber", randomnumber);
iimPlay("autoreg.iim")
But he don't generate the randoms numberst between 101...TAG POS=1 TYPE=INPUT:TEXT FORM=ACTION:http://narutowars.ru/register.php?action=register ATTR=ID:fld1 CONTENT=rnumber
omg what i do wrong?
-
- Posts: 15
- Joined: Tue Feb 23, 2010 2:06 pm
Re: Random Number
Hi,
I'm a very beginner at this, but I also want to generate a random number.
In my script, I want to make it WAIT a random number of seconds.
What do I do for this to work on my .iim?
Do I create two .js script? One with
"var randomnumber=Math.floor(Math.random()*101)"
and another to actually run the iim?
"iimSet("rnumber", randomnumber);
iimPlay("autoreg.iim")"
If this is the case, what do I input in the .iim to load this script?
I want it to insert in "WAIT SECONDS="
I'm a very beginner at this, but I also want to generate a random number.
In my script, I want to make it WAIT a random number of seconds.
What do I do for this to work on my .iim?
Do I create two .js script? One with
"var randomnumber=Math.floor(Math.random()*101)"
and another to actually run the iim?
"iimSet("rnumber", randomnumber);
iimPlay("autoreg.iim")"
If this is the case, what do I input in the .iim to load this script?
I want it to insert in "WAIT SECONDS="