Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

iTunes 11 shuffle script command not working

Since upgrading to iTunes 11, my iTunes scripts are failing due to the fact that iTunes 11 does not recognize the "set shuffle" command in Apple Script. Any ideas or work arounds will be appreciated. Amazing how this was not caught.

Posted on Dec 3, 2012 6:30 PM

8 replies

Sep 12, 2013 6:52 PM in response to TomInAlberta

Thanks for this! I used it and it works great. However, for me, it's not a "toggle", it just turns it on if it's off.

I added an "if" function to make it a proper toggle!


tell application "System Events"

tell application process "iTunes"

tell menu 1 of menu item "Shuffle" of menu "Controls" of menu bar 1

set menuitems to name of menu items


if item 1 of menuitems is "Turn On Shuffle" then

clickmenu item 1

end if


if item 1 of menuitems is "Turn Off Shuffle" then

clickmenu item 1

end if


end tell

end tell

end tell



thanks for the help!!

Mar 15, 2015 1:49 AM in response to tails-4

Here are a couple more scripts for toggling shuffle in the latest iTunes. The first one toggles it via the dock:


tell application "System Events" to tell UI element "iTunes" of list 1 of process "Dock"

if not (exists) then return

perform action "AXShowMenu"

click menu item "Shuffle" of menu 1

end tell


You can watch the dock icon menu appear when that one executes.

This second one toggles it invisibly, via the menu:

tell application "System Events"

tell application process "iTunes"

tell menu 1 of menu item "Shuffle" of menu "Controls" of menu bar 1

if (value of attribute "AXMenuItemMarkChar" of item 1 of menu items as string) = "✓" then

click menu item 2

else

click menu item 1

end if

end tell

end tell

end tell

I made this script by modifying what people have written so far, and customizing it to the more recent iTunes menu interface.

iTunes 11 shuffle script command not working

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.