Reputation: 529
I have two questions, the first is, I've done some research and it seems you are not able to create an if statement with imacros, in chrome at least. I think you can run JS with Firefox right?
The question is, can you write an if statement using .iim ?
Question two is, if I can't, would there be any way to make it so instead of a TIMEOUT making the script stop, it would instead just restart/loop the macro? so like:
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"
This would make it so if for some reason it cant click on the google image (what the macro is doing^) it will go back to google.com and repeat the macro
Upvotes: 0
Views: 1257
Reputation: 5299
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).
Upvotes: 1