I have a very simple automator script set up:
Find Video files in “Downloads” folder that are larger than 50 MB
Move those files to the “Files to Convert” folder
The script works perfectly when there are video files in the folder to convert, the problem is it throws an error when there are no files. I receive a “The action move finder items encountered an error” “The action move items was not supplied with the required data”
I can see why the script is failing but do not know how to tell it to ignore the error if no files are found.
Any thoughts?
Hello, tbharber. You could try using the following script:
on run {input, parameters}
set mylist to {}
repeat with elem in input
try
set the end of mylist to (POSIX path of elem)
end try
end repeat
set oldtid to AppleScript's text item delimiters
set AppleScript's text item delimiters to {return}
set flatlist to mylist as text
set AppleScript's text item delimiters to oldtid
set these_files to flatlist
if these_files is "" then
display alert "No files are selected" as warning
error number -128
end if
return input
end run
If you paste this into the Run AppleScript action in Automator it should display a dialog box and report a user canceled error, this will stop the workflow. I am sure that there is a simpler way of doing this, but I know that this one works. I hope that this is what you were after.
Note: this assumes that the input to the action would be the files.