Spotify Control
Use the bundled wrapper script to keep Spotify automation consistent and to avoid rebuilding AppleScript commands by hand.
Run the wrapper
- Use
scripts/spotify_control.shfor Spotify actions. - Let the wrapper open Spotify automatically when the app is not already running.
- Use
currentonly when the user explicitly asks what is playing.
Choose the action
- Use
play,pause, orplaypausefor playback state changes. - Use
nextorprevto move between tracks. - Use
currentto fetch the current track and artist. - Use
get-volumeorset-volumefor Spotify's internal volume. - Use
get-positionorset-positionfor playback position in seconds. - Use
set-shuffle on|offorset-repeat on|offfor playback modes. - Use
play-urionly when the user gives a Spotify URI directly.
Common examples
./scripts/spotify_control.sh play
./scripts/spotify_control.sh pause
./scripts/spotify_control.sh next
./scripts/spotify_control.sh current
./scripts/spotify_control.sh set-volume 40
./scripts/spotify_control.sh set-shuffle on
./scripts/spotify_control.sh play-uri spotify:track:TRACK_ID
Operating guidance
- Treat a clear playback request as explicit user intent to act.
- Ask a follow-up only when the action is ambiguous or when the user wants a specific song without a Spotify URI.
- Do not fetch current track info after
play,pause,next, orprevunless the user explicitly asks for it. - When the user asks what is playing, format the response as
"Song Name" - Artist. - Explain that AppleScript playback of a specific song, playlist, or album requires a Spotify URI.
Failure handling
- Report clearly when Spotify is not installed on the Mac.
- Report clearly when Spotify is running but no track is active and
currentreturns nothing useful. - Reject invalid numeric values for volume or position before running AppleScript.