Skip to content

Instantly share code, notes, and snippets.

@youvegotmoxie
Created August 4, 2015 06:24
Show Gist options
  • Select an option

  • Save youvegotmoxie/a39ab4c218880024438d to your computer and use it in GitHub Desktop.

Select an option

Save youvegotmoxie/a39ab4c218880024438d to your computer and use it in GitHub Desktop.
# Control iTunes from command line
# Play iTunes
function iplay() {
osascript -e 'tell application "iTunes" to play'
}
# Pause iTunes
function ipause() {
osascript -e 'tell application "iTunes" to pause'
}
# Skip to next track
function inext() {
osascript -e 'tell application "iTunes" to next track'
}
# Skip to previous track
function iprev() {
osascript -e 'tell application "iTunes" to previous track'
}
# Display iTunes status, current artist and track
function istatus() {
artist=`osascript -e 'tell application "iTunes" to artist of current track as string'`
track=`osascript -e 'tell application "iTunes" to name of current track as string'`
echo "Current track $artist: $track"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment