Sync two iPhones with two different iTunes and iPhoto libraries script

I'm sure this is answered elsewhere, but I was not able to find a solution to this easily. My wife "L" and I, "J" have iPhones, also different tastes in music, and wanted a way to not have all of our own pictures filling up our default iPhoto library. So we first set up two different iTunes and iPhoto libraries. Two diffrent contact libraries would be nice, but contact groups worked okay for this. But then everytime we would sync, it meant opening both iTunes and iPhoto while holding the option key then selecting which library depending on which phone was going to be pluged in. Believe me, you only need to have "Automatically sync" turned on and plug in the wrong iPhone before all sorts of problems arise!
Let me state, I am not fluent with AppleScript, but rather I found bits and pieces close to what I wanted here and there on the www and kept playing until it worked. This works flawlessly everytime on our MacBook, and, unless your initials are J & L and there are only two of you, you will have to change some letters here and there throughout the script to make it work for your situation. Think of this as a rough draft and start to play. I'm sure there is a simpler way to write this script, so to all the real authors, please re-write!
So we have two libraries for iTunes and iPhoto. One set of libraries named J's iTunes library and J's iPhoto library, and another two named L's iTunes library and L's iPhoto library. I wanted to create one app that would close the current libraries, and open the correct ones (or return to our default libraries) depending on what iPhone was to be synced. Using AppleScript Editor and saving the script as an application, this is what I came up with:
display dialog "Do you want to continue to set iTunes and iPhoto libraries?" buttons {"Cancel", "Continue"} default button "Continue"
tell application "iPhoto" to quit
tell application "iTunes" to quit
set Y to the button returned of (display dialog "Which libraries do you want to use?" buttons {"L's", "Reset to Defaults", "J's"} default button "Reset to Defaults")
if Y = "Reset to Defaults" then set Y to "i"
if Y = "L's" then set Y to "l"
if Y = "J's" then set Y to "j"
tell application "System Events"
  key down option
  delay 1
          tell application "iPhoto"
  activate
  delay 3
                    tell application "System Events"
  key up option
                    end tell
          end tell
end tell
tell application "System Events"
  keystroke Y
          tell application "System Events"
  key code 36
          end tell
end tell
delay 2
tell application "System Events"
  key down option
          tell application "iTunes"
  activate
                    tell application "System Events"
  key up option
  keystroke return
                    end tell
          end tell
end tell
tell application "System Events"
  keystroke Y
end tell
tell application "System Events"
  key code 36
end tell
if Y = "i" then tell application "iTunes" to quit
if Y = "i" then tell application "iPhoto" to quit

Hi, thanks for your answer.
Unfortunately this does not work because iTunes still keeps one account with the store active regardless which library I open. So when I switch the account in the store it will be switched for both libraries. That means that I can not separate the iPhone applications and all the other specific sync parameters.
I thought about using my wife's account on the Mac and pointing iTunes to the new library - the problem here is that then the iPhoto library is not accessible any more......
I can't really believe that there is no solution from Apple - I mean there must be more couples and families out there with 2 and more iPhones syncing with one iTunes / iPhoto etc libraries.
Any other ideas? Thanks in advance!

Similar Messages

Maybe you are looking for