iMacro为twitter生成随机文本或随机数

时间:2016-02-05 18:54:56

标签: twitter imacros

我想随机发推文,所以我没有收到来自Twitter的消息,说你已经发了推文。

以下是不使用随机文本的代码。如何添加到此以便我可以输入随机文本/数字来发推文?

代码:

VERSION BUILD=8961227 RECORDER=FX
TAB T=1
URL GOTO=https://twitter.com/
WAIT SECONDS=1
EVENT TYPE=CLICK SELECTOR="#tweet-box-home-timeline" BUTTON=0
WAIT SECONDS=2
EVENTS TYPE=KEYPRESS SELECTOR="#tweet-box-home-timeline" CHARS="#twitter "
WAIT SECONDS=2
EVENT TYPE=CLICK SELECTOR="#timeline>DIV:nth-of-type(2)>DIV>FORM>DIV:nth-of-type(2)>DIV:nth-of-type(2)>BUTTON" BUTTON=0
WAIT SECONDS=4

1 个答案:

答案 0 :(得分:0)

如果您想从您定义的集合中获取随机文本,请尝试以下方法:

TAB T=1
URL GOTO=https://twitter.com/
WAIT SECONDS=1
EVENT TYPE=CLICK SELECTOR="#tweet-box-home-timeline" BUTTON=0
WAIT SECONDS=2

' define and add your texts here
SET texts "['randomText1', 'randomText2', 'randomText3']"
SET rndText EVAL("var texts = eval('{{texts}}'); texts[Math.floor(Math.random()*(texts.length))];")
EVENTS TYPE=KEYPRESS SELECTOR="#tweet-box-home-timeline" CHARS={{rndText}}

WAIT SECONDS=2
EVENT TYPE=CLICK SELECTOR="#timeline>DIV:nth-of-type(2)>DIV>FORM>DIV:nth-of-type(2)>DIV:nth-of-type(2)>BUTTON" BUTTON=0
WAIT SECONDS=4