Sync or eject iPods/iPhones in iTunes via AppleScript

Apr 25, '08 07:30:00AM

Contributed by: mjb

I find it frustrating that there's no quick and easy way to sync my iPod and iPhone in iTunes without a degree of mouse movement and clicking (someone please correct me if I'm wrong!). Since I'm a keyboard navigation fan, I wrote some very simple AppleScripts to either sync or eject all iPods/iPhones currently connected to iTunes. The scripts are identical apart from the type of action:

Sync iPod.scpt:

tell application "iTunes"
  repeat with s in sources
    if (kind of s is iPod) then update s
  end repeat
end tell
Eject iPod.scpt:
tell application "iTunes"
  repeat with s in sources
    if (kind of s is iPod) then eject s
  end repeat
end tell
I personally have these scripts in my user's Library/Scripts folder, and use Quicksilver to quickly invoke them when I want to force a sync or eject of my iPod/iPhone.

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080423220708741