Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Queue an iTunes song after currently playing library song' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Queue an iTunes song after currently playing library song
Authored by: jediknil on Apr 20, '07 09:20:45PM

Here's an updated version that handles queueing iPod tracks and queueing when no song is playing. And you don't need Quicksilver to assign a shortcut if you only want to use it in iTunes; just add it to iTunes' script menu (put the script in ~/Library/iTunes/Scripts) and use Apple's Keyboard Shortcuts (under Keyboard & Mouse in System Prefs).

Thanks for the original script, and for making it so easy to modify!

tell application "iTunes"
	set currentSource to container of view of front browser window
	if not (exists playlist " Queue" of currentSource) then
		set queuePlaylist to (make new user playlist ¬
			with properties {name:" Queue", shuffle:false} at currentSource)
	else
		set queuePlaylist to playlist " Queue" of currentSource
	end if
	set curtrack to {}
	if player state is not stopped then
		if current playlist is not queuePlaylist then
			delete tracks of queuePlaylist
			set curtrack to (duplicate current track to queuePlaylist)
		end if
	else
		delete tracks of queuePlaylist
	end if
	if selection is not {} then
		set sel to a reference to selection
		duplicate sel to queuePlaylist
	end if
	if curtrack is not {} then
		set playPosition to player position
		set curState to player state
		play curtrack
		set player position to playPosition
		if curState is paused then pause
	else if tracks of queuePlaylist is not {} and (player state is stopped or current playlist is not queuePlaylist) then
		play first track of queuePlaylist
	end if
end tell


[ Reply to This | # ]