Created
April 12, 2014 09:22
-
-
Save bradleybeddoes/10526564 to your computer and use it in GitHub Desktop.
Textual App script for announcing iTunes current track
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
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. |
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
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