Skip to content

Instantly share code, notes, and snippets.

@Daij-Djan
Created December 12, 2012 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Daij-Djan/4272736 to your computer and use it in GitHub Desktop.
Save Daij-Djan/4272736 to your computer and use it in GitHub Desktop.
script itunes and add a track (which you specify in this script) to itunes 11's new up next list
tell application "AppleScript Utility"
set GUI Scripting enabled to true
end tell
tell application "iTunes"
--get the song
set l to playlist "Purchased"
set t to item 5 of tracks of l
--focus it in list
reveal t
--show window
activate
end tell
tell application "System Events"
-- option enter
delay 1
key down option
delay 1
key code 36
key up option
-- Click the “Play Song” button in the annoying dialog.
set w to null
try
set w to window "Add to Up Next" of application process "iTunes"
end try
if w is not null then
set b to UI element "Play Song" of w
click b
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment