Script to delete (from playlist and disk) the currently playing OsX Music (uTunes) song

on deleteTrack(trackName)
tell application "Music"
set theTrack to track named trackName of playlist "Library"
set songFile to location of theTrack
delete theTrack
end tell
tell application "Finder" to delete songFile
end deleteTrack
on run
tell application "Music"
set currentSong to name of current track
end tell


tell application "Music"
end tell

end run
osascript /Users/yourname/path/to/deletePlayingSong.scpt




Software Engineer @ London []

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Code Coverage Report generation by Functional Testing

Singly Linked Lists

Routing in React With React Router

Getting clever with Array#reduce

· Differences between Functional Components and Class Components in React:

How exactly do browsers render websites?

Manage your customers’ clipboard with React Hooks.

Abstract Syntax Trees by example

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Elvis Ciotti

Elvis Ciotti

Software Engineer @ London []

More from Medium

A walk through Córdoba along Julio Romero de Torres with CoSpaces Edu

So, Korean huh?

How Oracle DRG works and how to integrate with FortiGate NGFW

Prototype vs MVP: What is the Best Choice for Your Project?

Prototype vs MVP guide