Skipping tracks with repeat on? Preposterous!In iTunes 10, you could skip to the next/previous track when Repeat One was turned on. In 11 & 12, they assume that by “skip ahead”, you somehow mean “rewind this track”.

This really bothers some people.
Do not judge us, we have our reasons!

And here’s one way to fix it.

It took some work, but I finally came up with some AppleScript to handle this. Basically, we’re checking to see if Repeat One is on. If it is, we quickly disable it, skip to the next (or previous) track, and then turn it back on. Apple borked the old way of doing this (same with shuffle), so we’re using menu bar items instead.

-- This script lets you skip songs in iTunes 11/12 even if repeat one is on

tell application "System Events"
	tell process "iTunes"

		-- Find out if repeat one is on
		-- This finds out if the menu item is checked
		set isRepeatOneOn to (value of attribute "AXMenuItemMarkChar" of menu item 3 of menu 1 of menu item "Repeat" of menu 1 of menu bar item "Controls" of menu bar 1 as string) ≠ ""

		if isRepeatOneOn is true then

			-- Set repeat to ALL
			click menu item 2 of menu 1 of menu item "Repeat" of menu 1 of menu bar item "Controls" of menu bar 1

			-- Skip to previous track...
			click menu item "Previous" of menu 1 of menu bar item "Controls" of menu bar 1

			-- Need this, or the next step happens too fast
			delay 0.1

			-- Reactivate Repeat One
			click menu item 3 of menu 1 of menu item "Repeat" of menu 1 of menu bar item "Controls" of menu bar 1

		else
			-- Just skip to previous track
			click menu item "Previous" of menu 1 of menu bar item "Controls" of menu bar 1
		end if

	end tell
end tell

You can copy/paste that, or you can just download the script files here.
There’s one script for skip ahead, and one for skip back.

Wait—how do I use these?

Valid question. They’re not all that useful, really—unless you assign them to hotkeys.

Head on over here to Mac OS X Tips for ways and examples to set hotkeys to run AppleScripts.

Personally, I used Quicksilver to control iTunes for years, but now I use Alfred 2 (with Powerpack.)

(Since it’s not super obvious, let me know in the comments if you’d like help setting up either of these scripts using Alfred 2.)

 

3 replies

oblivioussays:

no solution for windows users?

Toastmaster Generalsays:

Not that I’ve been able to take time and figure out, unfortunately. 🙁 I wonder, though, if something like AutoHotKey might work to achieve the same effect I’m doing here with AppleScript?

Timsays:

I finally broke down and upgraded to iTunes 11. Thanks so much for these scripts! What a pain that someone has to go to these lengths for simple functionality. But I’m grateful you did that for us.


Leave a Reply

Your email address will not be published. Required fields are marked *