Skip to content

Instantly share code, notes, and snippets.

@bradleybeddoes
Created April 12, 2014 09:22
Show Gist options
  • Save bradleybeddoes/10526564 to your computer and use it in GitHub Desktop.
Save bradleybeddoes/10526564 to your computer and use it in GitHub Desktop.
Textual App script for announcing iTunes current track
Hacked on from original at http://hawkee.com/snippet/9027/
Save np.scpt at ~/Library/Application Scripts/com.codeux.irc.textual/np.scpt
Removed stuff I didn't need and fixed a bug
np.scpt:160:165: script error: Expected “then”, etc. but found identifier. (-2741) Y0
Enjoy.
on textualcmd()
set nowPlaying to "I'm not currently playing anything."
# iTunes
if isRunning("iTunes") then
tell application "iTunes"
if player state is playing then set nowPlaying to "Listening via iTunes to: " & artist of current track & " - " & name of current track & " (" & album of current track & ")"
end tell
end if
return nowPlaying
end textualcmd
on isRunning(mediaPlayer)
tell application "System Events"
tell application "System Events" to return exists (processes where name is mediaPlayer)
end tell
end isRunning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment