Apple Event: May 7th at 7 am PT

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Automator if-then-else possible?

Hi, I am trying to create a workflow that will monitor a web page and send me email if the page contains a certain keyword. I got it working, I get email; the email contains the keyword, or is an empty message when the keyword is missing.

I would rather not get these empty messages is possible. Until I figure this out, I may send these message at some gmail address and create a fiter there to forward only message with that keyword. Not elegant but should work. Anyway, long term I want a more elegant solution. Here is what I have in Automator:

1) Get Specific ULRs

2) Get Text from Webpage

3) Filter Paragraphs (and here is where I check whether the keyword shows up or not)

4) New mail message (which contains they keyword from #3, or is empty)

5) Send outgoing messages.

As I said, the workflow always works, and will send a message with that keyword, or an empty message. How do I make the workflow send email ONLY if they keyword is detected? There is not IF in Automator as far as I can see. This is the first time I try to do something in Automator so maybe I am missing something.

Thanks folks.


Mac OS X (10.6.8)

Posted on Jun 10, 2012 8:50 AM

Reply
Question marked as Best reply

Posted on Jun 10, 2012 10:20 AM

Automator doesn't have any control actions, so any comparisons you will need to do yourself. This is easy though, you can run a script after your Filter Paragraphs action to quit the workflow if the result is empty - for example, add a Run AppleScript action after the filter/before the new message and paste the following script into it:


onrun {input, parameters}



ifinputis {} thenerror-128-- cancel on empty input list



returninput

endrun

4 replies

There are no replies.

Automator if-then-else possible?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.