You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

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

Stopping Automator "Run Applescript" if file not found.

Hi all,

I'm creating a folder action that, when a file is added to the folder, will search the folder to see if the file is of a certain type (by the extension) and then run an Applescript that will open the file in the appropriate program. The problem is that not all files that go into the folder are of the correct type. Is there any way to tell Automator or Applescript to stop if no file is found (essentially "input" should be empty)?

Thanks,
Stuart

Mac OS X (10.4.6)

Posted on Jun 4, 2006 9:43 PM

Reply
Question marked as Top-ranking reply

Posted on Jun 4, 2006 9:57 PM

To stop a workflow saved as an application you would put tell me to quit in your AppleScript action's if block. If you'd written the folder action in plain AppleScript you could use error number -128 to fail silently.

if input is {} then tell me to quit
3 replies

Jul 12, 2006 7:45 PM in response to Michael Henley

Thank you for a helpful answer. I recently wrote an Automator application that opens several web pages in tabs and checks my email. It is set to run at login. Using a modification of your code and a line I pick up elsewhere I was able to make the Automator application end when I press command+. keys.

Perhaps you can answer a different question for me. I am new to Automator but catching on quickly. I am not very good at AppleScript however. I have three automator-based workflows saved as applications. One needs to run every day and then trigger one of the other two depending upon the day or date.

The branching seems to work OK but once the appropriate workflow starts to run I get an error. I think it is -1708. Any help you can provide would be appreciated.

2 Gig G5 Mac OS X (10.4.7)

Jul 12, 2006 8:04 PM in response to Slydude

You are very welcome!

While your second question is on topic for the forum, it's off-topic for this thread. To get the quickest answer simply copy+paste the last half of your post to a new Topic post at the forum level, and I'll take a look at it there. If you have any AppleScript code in your workflow, please include it in the post. Thanks! 🙂

Stopping Automator "Run Applescript" if file not found.

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