Created
September 2, 2022 03:13
-
-
Save FallenMax/e0a6f7b75fefacf7f133d139192efb3b to your computer and use it in GitHub Desktop.
some spotify applescript, use skhd to control spotify with shortcut
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- activate | |
tell application "Spotify" | |
activate | |
end tell | |
-- next track | |
tell application "Spotify" | |
next track | |
delay 1 | |
set trackName to name of current track | |
set artistName to artist of current track | |
set albumName to album of current track | |
-- set isStarred to starred of current track | |
set playCount to played count of current track | |
display notification albumName with title artistName & " - " & trackName | |
end tell | |
-- previous track | |
tell application "Spotify" | |
previous track | |
delay 1 | |
set trackName to name of current track | |
set artistName to artist of current track | |
set albumName to album of current track | |
-- set isStarred to starred of current track | |
set playCount to played count of current track | |
display notification albumName with title artistName & " - " & trackName | |
end tell | |
-- play/pause | |
tell application "Spotify" | |
playpause | |
delay 1 | |
set trackName to name of current track | |
set artistName to artist of current track | |
set albumName to album of current track | |
-- set isStarred to starred of current track | |
set playCount to played count of current track | |
display notification albumName with title artistName & " - " & trackName | |
end tell | |
-- show current track | |
-- https://computers.tutsplus.com/tutorials/the-ultimate-beginners-guide-to-applescript--mac-3436 | |
-- open with Script Editor, check `Dictionary` for available commands | |
-- reference: https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_cmds.html | |
tell application "Spotify" | |
set trackName to name of current track | |
set artistName to artist of current track | |
set albumName to album of current track | |
-- set isStarred to starred of current track | |
set playCount to played count of current track | |
display notification albumName with title artistName & " - " & trackName | |
end tell | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment