Scripting Itunes

When i am listening to a song in itunes i would like to select another song from within itunes and have another app like QuickTime or Realplayer open and play that track if itunes is already playing.

Is this possible, and if so can someone help point me in the right direction.

Thanks in advance.

Hi dwolfe,

Here ya go.

tell application "iTunes"
	get selection of front browser window
	if (selection of front browser window) is not {} then
		if player state is playing then
			set sel to selection
			set x to item 1 of sel
			set thetrack to location of x
			tell application "QuickTime Player"
				open thetrack
			end tell
		end if
	end if
end tell

It’ll open a track in QuickTime when iTunes is playing. If you have multiple tracks selected, it opens the first. And I just found this out, QuickTime even opens PDFs. :slight_smile:

Gary

Thanks!
I didn’t expect such a quick reply this is exactly what I wanted.

You rock thanks again!

Glad I could help.

If you’re looking for other things, you can find hundreds of scripts for iTunes at Doug’s AppleScripts for iTunes. It’s worth a look just to see what’s possible.

Gary