我有一个iMacros代码,可以复制一个博客中的内容,并将文章图片和文章正文内容发布到我的Facebook Wall帖子中。这是工作代码:
VERSION BUILD=844 RECORDER=CR
SET !EXTRACT_TEST_POPUP NO
SET URL http://www.marketwatch.com/story/too-early-to-tell-if-trump-bump-seen-in-jobs-numbers-economists-say-2017-03-10
URL GOTO={{URL}}
WAIT SECONDS=2
TAG POS=1 TYPE=IMG ATTR=CLASS:article-image<SP>MG EXTRACT=HREF
SET IMG {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS=1 TYPE=DIV ATTR=ID:article-body EXTRACT=TXT
SET BODY EVAL("var s=\"{{!EXTRACT}}\"; s=s.split('More from this Website')[0]; s;")
SET !EXTRACT NULL
URL GOTO=www.facebook.com
WAIT SECONDS=2
TAG POS=1 TYPE=DIV ATTR=CLASS:composerAudienceWrapper<SP>stat_elem<SP>_ej0
WAIT SECONDS=2
EVENTS TYPE=KEYPRESS SELECTOR="DIV[CLASS='_1mf _1mj']" CHARS="{{IMG}}"
WAIT SECONDS=5
EVENTS TYPE=KEYPRESS SELECTOR="DIV[CLASS='_1mf _1mj']" KEYS="[8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8]"
WAIT SECONDS=2
EVENTS TYPE=KEYPRESS SELECTOR="DIV[CLASS='_1mf _1mj']" CHARS="{{BODY}}"
TAG POS=1 TYPE=BUTTON FORM=ID:u_0_15 ATTR=TXT:Post
WAIT SECONDS=2
在这一行:EVENTS TYPE=KEYPRESS SELECTOR="DIV[CLASS='_1mf _1mj']" CHARS="{{IMG}}"
,当代码将图片网址粘贴到Facebook时,它会中途完成工作并开始误操作 - 这意味着它开始点击我的Facebook墙上的一些randone按钮(同时这代码行仍在执行中......
这个问题有解决方案吗?
答案 0 :(得分:0)
如果要粘贴大量文本,请尝试通过剪贴板执行此操作,例如:
SET !EXTRACT_TEST_POPUP NO
SET URL http://www.marketwatch.com/story/too-early-to-tell-if-trump-bump-seen-in-jobs-numbers-economists-say-2017-03-10
URL GOTO={{URL}}
WAIT SECONDS=2
TAG POS=1 TYPE=IMG ATTR=CLASS:article-image<SP>MG EXTRACT=HREF
SET IMG {{!EXTRACT}}
SET !EXTRACT NULL
TAG POS=1 TYPE=DIV ATTR=ID:article-body EXTRACT=TXT
SET BODY EVAL("var s=\"{{!EXTRACT}}\"; s=s.split('More from this Website')[0]; s;")
SET !EXTRACT NULL
URL GOTO=www.facebook.com
WAIT SECONDS=2
SET !CLIPBOARD {{IMG}}
TAG POS=1 TYPE=LABEL ATTR=TXT:"Choose a file to upload"
TAG POS=R1 TYPE=DIV ATTR=ID:* EXTRACT=HTM
SET id EVAL("'{{!EXTRACT}}'.match(/id="(.*?)"/)[1];")
EVENT TYPE=CLICK SELECTOR="#{{id}}>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV" BUTTON=0
EVENT TYPE=KEYPRESS SELECTOR="#{{id}}>DIV>DIV>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>DIV:nth-of-type(2)>DIV" CHAR="v" MODIFIERS="ctrl"
' ...