AppleScript to skip Automator workflow step - when no files are provided
My current Automator workflow:
Get Specified Finder Items (path to folder auto-populating with images from a camera)
Get Folder Contents
Sort Finder Items - by Creation Date in descending order (gets oldest item first)
Limit Number of Items - Limit to First 1 items
Move Finder Items (If no items are passed to this step skip it)
Loop - Automatically; Stop after 20 minutes; Use the original input
What I am trying to accomplish:
I'm trying to write an AppleScript to skip the "Move Finder Items action" when it is not supplied with any files (from the previous workflow step), moving on to the next step which is a loop to begin my workflow again.
Big picture:
I have a workflow, where I am moving files from one folder to another folder (one at a time). When the input folder is empty, Automator comes back with "No item references were passed to the Move Finder Items action (-50)"; which it should - because it is not passed any files. I would like to ignore this error (or skip this step) and continue with the workflow if no files are provided to the "Move Finder Items action". I currently have an AppleScript (see below) that stops the workflow when this error occurs, but I would like to have this flow continue, not stop.
AppleScript:
on run {input, parameters}
if input is {} then error number -128 -- 'user cancelled'
return input
end run
Please help me create a script to skip this step, or to restart the Automator workflow when no files are passed to the "Move Finder Items action".
OS X Mountain Lion (10.8.3)