How to use iMacros with logic like if/else for ins

2019-06-14 05:17发布

问题:

I am using iMacros for instagram automation to create an auto-follower. I go to the hashtag section, then go to most recent, and I want to follow anyone in the "most recent section" that I am not already following.

This is what I have:

VERSION BUILD=844 RECORDER=CR
URL GOTO=https://www.instagram.com/p/BRvYjUPjB7m/?tagged=scootershop
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow
TAG POS=1 TYPE=A ATTR=TXT:Next
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow
TAG POS=1 TYPE=A ATTR=TXT:Next
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow
TAG POS=1 TYPE=A ATTR=TXT:Next

But i want it to do a sort of "if the button txt is 'follow', then click it" but if it says 'following', just click "Next".

I am aware iMacros has no built in if/else statement, but I am brand new to this, and need some guidance. Thank you!

回答1:

You can try something like this:

URL GOTO=https://www.instagram.com/p/BRvYjUPjB7m/?tagged=scootershop

SET !ERRORIGNORE YES
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow
SET !ERRORIGNORE NO
TAG POS=1 TYPE=A ATTR=TXT:Next

SET !ERRORIGNORE YES
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow
SET !ERRORIGNORE NO
TAG POS=1 TYPE=A ATTR=TXT:Next

SET !ERRORIGNORE YES
TAG POS=1 TYPE=BUTTON ATTR=TXT:Follow
SET !ERRORIGNORE NO
TAG POS=1 TYPE=A ATTR=TXT:Next


回答2:

The !ERRORIGNORE solution from Shugar's answer is the most elegant and simplest solution for this use case.

But if needed then iMacros for Firefox (but not iMacros for Chrome) includes Javascript support, which allows you to use if/then statements.

http://wiki.imacros.net/iMacros_for_Firefox#Javascript_Scripting_Interface