Check if iTunes is playing a song

I’d like to run a macro under the condition that
(a) iTunes is currently not playing a song - and/or -
(b) iTunes stopped playing x minutes ago

Is there any way to check iTunes’s status (playing/not playing/hasn’t played within the last 15 minutes)?

Thanks for any hint.


Hey Alex,

I don’t have time to fool with this just now, but here are a couple of hints.

Yes. KM can do a timed macro on a 15 minute cycle.

But. You must resort to AppleScript to get information from iTunes.

Paste this into the Applescript Editor and run it to see all the properties. (A track must be selected.)

tell application "iTunes"
		set track_Var to current track
		return properties of track_Var
	on error
		set track_Var to false
	end try
end tell

The best source of information for iTunes scripts is here:

Other AppleScript help may be found here:


As was stated, you’ll need to use AppleScript. But, one thing that can help is making a Smart Playlist in iTunes. I would make a Smart Playlist for all songs played today and sort that by Time. Then, you only need to use AppleScript to query the first item in that playlist.

Hello, as mentioned before you do need to use AppleScript to perform this. I have gone through the scripts mentioned here and i personally found this link very informational. i feel you should go through this once.

If the only property @djqx needs is whether iTunes is playing or not, and doesn’t need the track specifics, then:

tell application "iTunes" to return player state is playing