Imacros: Random wait time?

和自甴很熟 提交于 2019-12-11 08:34:55

问题


I'm trying to make a random wait between 30 minutes to one hour.

The code I'm using is supposed to do this, but after the last line of code the script simply stops.

Here's the script

TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:true-random-integer-generator-min CONTENT=900
TAG POS=1 TYPE=INPUT:TEXT ATTR=ID:true-random-integer-generator-max CONTENT=3600
WAIT SECONDS=1
TAG POS=1 TYPE=SPAN ATTR=ID:true-random-integer-generator-result&&TXT:* EXTRACT=TXT
SET !VAR1 {{!EXTRACT}}
WAIT SECONDS={{!VAR1}}
SET !EXTRACT NULL

回答1:


'set the delay lower limit, this can be changed
SET !VAR1 1800
'set the remaining time interval that need randomized
SET !VAR2 1800
'calculate the random number
SET !VAR3 EVAL("var randomNumber=Math.floor(Math.random()*\"{{!VAR2}}\" +\"{{!VAR1}}\"); randomNumber;") 
WAIT SECONDS={{!VAR3}}


来源:https://stackoverflow.com/questions/13801272/imacros-random-wait-time

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!