Applescript to return name of new file added to folder This is mostly a test so that I can work up to the function that I want to create down the line. I'm very new to AppleScript so bear with me!

I wrote this as an attempt to test a folder action that receives a new file and then displays an alert with the name of the newly added file.

This Script was saved to ~/Library/Scripts/Folder Action Scripts. And then assigned to a folder on my desktop called Return Name. I see the script run when a new item is dropped in but nothing happens.

Can anyone just explain to me what is wrong here?

Thanks!

on adding folder items to InputFolder after receiving NewItem
tell application "Finder"
    set FileName to name of NewItem
    activate
    display alert "New Items Added!" message ("File called " &amp; FileName &amp; " have been added" as string)
end tell
end adding folder items to
This should work for you

on adding folder items to theFolder after receiving theNewItems
    delay 20 -- ALLOW MULTIPLES TO BE ADDED BEFORE PROCESSING - OPTIONAL
    set filesAdded to {}
    tell application "Finder" to set folderName to name of folder theFolder
    repeat with i from 1 to count of theNewItems
        set thisItem to item i of theNewItems
        tell application "Finder"
            set FileName to name of thisItem
            set end of filesAdded to (FileName &amp; linefeed)
        end tell
    end repeat
    activate
    display alert "New Items Added!" message (("These Files Have Been Added To " &amp; theFolder) &amp; linefeed &amp; linefeed &amp; filesAdded as string)
end adding folder items to