Skip to content

Instantly share code, notes, and snippets.

@jedda
Created March 24, 2012 01:33
Show Gist options
  • Save jedda/2177086 to your computer and use it in GitHub Desktop.
Save jedda/2177086 to your computer and use it in GitHub Desktop.
Resume/Pause iTunes Downloads with AppleScript
# Resume/Pause iTunes Downloads with AppleScript
# Jedda Wignall
# http://jedda.me
# [email protected]
#
# For use with Ration: http://www.rationapp.com
# You will need to edit the row number on line 19 to match your settings in iTunes.
# Row 16 worked for me, but you may not have Podcasts or other lines displayed, so this could break it.
# Play around, and you should get it working. Maybe i'll edit this at some stage to do some more checking
# and select the right row automatically.
activate application "iTunes"
tell application "System Events"
if UI elements enabled then
tell application process "iTunes"
-- insert GUI Scripting statements here
click menu item "iTunes" of menu 1 of menu bar item "Window" of menu bar 1
select row 16 of outline 1 of scroll area 2 of window "iTunes"
click button "Resume All" of window "iTunes"
# uncomment for pause - click button "Pause All" of window "iTunes"
end tell
else
beep
display dialog "GUI Scripting is not enabled" & return & return & "Open System Preferences and check Enable Access for Assistive Devices in the Universal Access preference pane, then run this script again." with icon stop
if button returned of result is "OK" then
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
end tell
end if
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment