I'm making an app in Automator to quickly delete my iMovie Library (to save space). However, I want my app to check if the iMovie Library has already been deleted and show a dialog saying so. I know how to make the dialog, but I can't figure out how to do it. How do I do this? I'm using macOS 10.11.

My workflow:

  1. Ask for confirmation
  2. Get specified Finder items (the validation would go after this)
  3. Move Finder items to trash
  4. Run AppleScript (to show a dialog saying "Done")
  • Show us the workflow and code you already have. Also what version of OS X/macOS are you running? Commented May 20, 2017 at 18:46

2 Answers 2


You can use a Run AppleScript action to perform validation. Between actions 2 and 3 in your workflow, add a Run AppleScript action with the following:

on run {input, parameters}
    if input is {} then
        display notification "File already deleted"
        tell me to quit
    end if
    return input
end run

This checks if the input is empty (because the file can't be found), and if so, runs your desired code — you can customise display notification as you please, such as showing an alert. The use of tell me to quit if the input is empty will stop the workflow at this point.


An old question, but a bit more info could be added.

You can use other "Run" actions Automator, not just AppleScript. You can Run a Shell Script as well. An exit value of the script that is 0 will be deemed a successful check, any other value will be an error. And the equivalent to "Display notification" is the stderr from the script. So:

  1. Ask for Text - creates a single-variable dialog
  2. Set Value of Variable - gives the collected variable a name
  3. Run Shell Script - pass input to [stdin]
     read -r varname
     if [[ ! "$varname" =~ ^SomeValidatingRegexp$ ]]; then
       echo "Validation failed!" >&2
       exit 1
  4. Ask for Text - next variable
  5. etc.

You must log in to answer this question.