I want to get a list of file names (not paths, just the filenames without extension) of some dropped items in AppleScript.

I can get the droplet to reveal each item's names incrementally, but what I really want is a list, each text item separated by a line break. Then I can pass this list to my next action.

Can anyone help? This seems so simple and I feel like I've dealt with far more complex things in AppleScript before!

1 Answer 1


One solution I've found is rather more complicated than I thought it would be.

I'll paste it here for anyone interested in doing the same thing, and in the hope that someone has some simpler solution!

on open Dropped_Files
    tell application "Finder"
        set theList to {""}
        repeat with i from 1 to count of Dropped_Files
            set NameOfFile to name of (item i of Dropped_Files)
            set AppleScript's text item delimiters to return
            set NameOfFile2 to (NameOfFile as string) & return
            copy NameOfFile2 to end of theList
        end repeat
        set AppleScript's text item delimiters to ""
        set the clipboard to theList as string
    end tell
end open

on nextStage(theList)
    set songList to "Macintosh HD:Applications:Automator stuff:01b iTunes Scripts:SongLust.txt"
    tell application "TextWrangler"...

And so on to the bit that pastes it into TextWrangler.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .