iTunes 11 AppleScripts – Search and Show Up Next

iTunes 11 was released today. Liking it a lot so far, but I really wish they added a global keyboard command to bring up the search in the MiniPlayer (one of my favorite additions). Now, through the magic of AppleScript, you can add it yourself.

Open Automator and create a new Service with no input. Then add the “Run AppleScript” action. Paste in the following code:

on run
	tell application "iTunes"
		activate
	end tell
	
	tell application "System Events"
		tell process "iTunes"
			click ((buttons of window "MiniPlayer") whose description contains "Search")
			click ((text fields of window "MiniPlayer") whose description is "Search Music")
		end tell
	end tell
end run

Save and give your script a name. Then open System Preferences, go to Keyboard and Keyboard Shortcuts. Under Services you should see the new service you created. Select it and give it a keyboard command (I chose Command+Shift+Space). That’s it!

Pressing the keyboard shortcut once will bring up the MiniPlayer and activate the search field. Pressing it a second time makes the search field disappear.

Bonus: You can also write a simple script to bring up and close the Up Next display. This one does not activate the MiniPlayer window.

on run
	tell application "System Events"
		tell process "iTunes"
			click ((buttons of window 1) whose description contains "up next")
		end tell
	end tell
end run