我有两个问题,第一个是,我做了一些研究,看起来你至少无法用chrome创建一个带有imacros的if语句。我认为你可以用Firefox运行JS吗?
问题是,你能用.iim写一个if语句吗?
问题二是,如果我不能,是否有任何方法可以实现,而不是TIMEOUT使脚本停止,它只会重新启动/循环宏?所以喜欢:
SET !TIMEOUT 60 *so that restart macro on fail*
URL GOTO=https://www.google.com/
TAG SELECTOR="HTML>BODY>DIV:nth-of-type(2)>DIV:nth-of-type(9)>SPAN>CENTER>DIV>IMG"
如果由于某种原因它无法点击谷歌图片(宏正在做什么^),它会回到google.com并重复宏
答案 0 :(得分:1)
I think you can run JS with Firefox right?
Yes, it's right.
At stackoverflow.com you can find many ideas of how to use logic within 'iim'-macros.
And here is a prompt tip for you:
SET !EXTRACT_TEST_POPUP NO
SET sel "HTML>BODY>DIV:nth-of-type(2)>DIV:nth-of-type(9)>SPAN>CENTER>DIV>IMG"
URL GOTO=https://www.google.com/
SET !EXTRACT NULL
SET !ERRORIGNORE YES
TAG SELECTOR={{sel}} EXTRACT=HTM
SET ifSel EVAL("'{{!EXTRACT}}'.match(/img/) ? '{{sel}}' : '';")
TAG SELECTOR={{ifSel}}
SET !ERRORIGNORE NO
SET stop EVAL("if ('{{ifSel}}') MacroError('Already clicked!');")
Try to play this macro repeatedly (so called 'loop mode') with the 'Max' value set to a very big arbitrary number (for example, 999999999).