Sign up ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm working on a script to manage my "queue" playlist in iTunes and wanted an easy and fast way to quickly delete all songs in that playlist.

Applescript seemed the best option and I created a little script executable with a keyboard shortcut. However it doesn't seem to work.

This is the relevant part:

tell application "iTunes"
    repeat with t in tracks of playlist "queue"
        tell playlist "queue" to delete t
    end repeat
end tell

The problem is that not all the tracks are deleted, only a part of them. Executing the script multiple times, eventually, deletes all the tracks in the playlist.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

I've had the exact same problem. There's more and more AppleScript bugs in each version of OS X.

If you just want to delete all tracks on a playlist, single expressions like this don't seem to skip any tracks and they're also faster:

tell application "iTunes"
    delete tracks of playlist "untitled playlist"
end tell

If you only need to delete some tracks, something like this might work:

tell application "iTunes"
        set tr to tracks of playlist "untitled playlist"
        if tr is {} then exit repeat
        repeat with t in tr
            delete t
        end repeat
    end repeat
end tell
share|improve this answer
thank you, you solved the problem. – Francesco Jul 15 '12 at 14:25
For some reason the "delete tracks of playlist" expression does not work for me. Script editor returns error "every track of playlist \"Not In Library"\ doesn't understand the "delete" message – RusI Feb 14 at 13:41

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.