Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
AppleScript to remove items from iTunes whose files have been deleted
tell application "iTunes"
set selectedTracks to selection
repeat with i from 1 to (length of selectedTracks)
if class of item i of selectedTracks is not shared track then
tell item i of selectedTracks to set {loc} to {get location}
if loc is missing value then
tell application "iTunes"
delete item i of selectedTracks
end tell
end if
end if
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment