Automator: get a folder if it dropped or ask for one otherwise

applescriptautomatorfinder

I'm building an automator application that acts on a folder that needs to be specified.

Until now, I've been using the "Ask for Finder items" action to ask for a the folder to be used, but I would like to be able to just drag 'n' drop the folder on the application icon.

Can it be done in automator? I've been thinking to use some applescript to check if any input was given.

Best Answer

You can do whole workflow in AppleScript:

on adding folder items to theFolder after receiving theItems
    repeat with anItem in theItems
        -- your code goes here  
    end repeat
end adding folder items to