Skip to content

Instantly share code, notes, and snippets.

@Hum4n01d
Created January 23, 2021 07:02
Show Gist options
  • Save Hum4n01d/ae62e6fec4dd622f9f186caebcd728ac to your computer and use it in GitHub Desktop.
Save Hum4n01d/ae62e6fec4dd622f9f186caebcd728ac to your computer and use it in GitHub Desktop.
Add the currently playing track to your Apple Music library
tell application "System Events"
tell process "Music"
perform action "AXRaise" of window 1
try
tell menu bar 1
tell menu bar item "Window"
tell menu "Window"
click menu item "Switch to MiniPlayer"
end tell
end tell
end tell
end try
end tell
tell process "Music"
try
tell menu bar 1
tell menu bar item "Song"
tell menu "Song"
click menu item "Add to Library"
end tell
end tell
end tell
end try
end tell
tell process "Music"
perform action "AXRaise" of window 1
try
tell menu bar 1
tell menu bar item "Window"
tell menu "Window"
click menu item "Switch to MiniPlayer"
end tell
end tell
end tell
end try
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment