Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iMacro to generate random text or random number

Tags:

random

imacros

I am using iMacros for quick static form filling and is there anyway I can generate and post random text using iMacros? For example can instead of good boy in the below iMacro for Google Search can I generate random text or random number and post it as content?

VERSION BUILD=8510617 RECORDER=FX
TAB T=1
URL GOTO=https://www.google.com.au/
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:gbqf ATTR=ID:gbqfq CONTENT=goodboy
TAG POS=1 TYPE=BUTTON FORM=ID:gbqf ATTR=ID:gbqfb
like image 442
Kerry Avatar asked Oct 25 '13 17:10

Kerry


People also ask

How do we generate a random number?

There are two main methods that a computer generates a random number: true random number generators (TRNGs) and pseudo-random number generators (PRNGs). The former uses some phenomenon outside the computer for its number generation, whereas the latter relies on pre-set algorithms to emulate randomness².

How do you generate a random number in HTML?

var numRand = Math. floor(Math. random() * 101); That will return a random number between 1-100.

How do I generate random numbers in Visual Studio?

Random numbers can be generated by the Visual Basic Rnd() function, that returns a floating-point value between 0.0 and 1.0. Multiplying the random numbers will specify a wider range. For example, a multiplier of 20 will create a random number between zero and 20.


2 Answers

You can generate a random string similar to the above solution with a slight modification. No need to read files or anything else if you simply want a random string with some specific length. It's a bit messy but it does the job

SET !VAR1 EVAL("var letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','w','x','y','z']; var string = ''; for(var i = 0; i < 10; i++){string += letters[parseInt(Math.random() * 25)]}; string")
like image 73
Chris Gibb Avatar answered Sep 22 '22 10:09

Chris Gibb


random number from 1 to 10

TAB T=1
URL GOTO=https://www.google.com.au/
SET !VAR1 EVAL("var randomNumber=Math.floor(Math.random()*10 + 1); randomNumber;")
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:gbqf ATTR=ID:gbqfq CONTENT={{!var1}}
like image 21
Bestmacros Avatar answered Sep 21 '22 10:09

Bestmacros