我正在使用iMacros进行快速静态表单填充,无论如何我可以使用iMacros生成和发布随机文本吗?例如,可以在下面的iMacro for Google Search中代替good boy
,我可以生成随机文本或随机数并将其作为内容发布吗?
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
答案 0 :(得分:15)
从1到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}}
答案 1 :(得分:9)
您可以稍微修改一下,生成类似于上述解决方案的随机字符串。如果您只是想要一个具有特定长度的随机字符串,则无需读取文件或其他任何内容。它有点乱,但它完成了工作
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")
答案 2 :(得分:3)
您可以将text.csv文件放在A列文本和B列编号中吗?
然后你可以使用这段代码。
VERSION BUILD=8510617 RECORDER=FX
SET !ERRORIGNORE YES
SET !DATASOURCE text.csv
SET !DATASOURCE_COLUMNS 2
SET !DATASOURCE_LINE {{!LOOP}}
TAB T=1
URL GOTO=https://www.google.com.au/
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:gbqf ATTR=ID:gbqfq CONTENT={{!COL0}}
TAG POS=1 TYPE=BUTTON FORM=ID:gbqf ATTR=ID:{{!COL1}}
答案 3 :(得分:2)
4个数字
SET !VAR3 EVAL("Math.floor(Math.random()*9999 + 1);")
4个字符
SET !VAR3 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 < 4; i++){string += letters[parseInt(Math.random() * 25)]};
string")
答案 4 :(得分:0)
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','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9'];
var string = '';
for(var i = 0; i < 7; i++){string += letters[parseInt(Math.random() * 36)]};
string")