Automator: Get filename

automationautomatorfolder-action

I'm creating a folder action to display a notification when a new file is downloaded and would like the notification to display the filename. I can't figure out how to extract the filename of the downloaded file and pass it on to the variable.

Best Answer

Try something like this:

Picture

Transcript:

  • Folder action receives files and folders to Downloads(default Folder Action script)

  • Run Applescript:

    on run {input, parameters} tell application "Finder" set filename to name of file input end tell end run

  • Set value of Variable: fileName

  • Ask for Confirmation: Title: Alert! The file fileName has been downloaded! Body: A new file has downloaded

So if I add a file named "NewFile.png", I get: Example