2

Prior to Catalina I used a script to trigger a sync to my iPhone and iPad - similar to:

tell application "iTunes"
    tell every source whose kind is iPod to update
end tell

Catalina removed iTunes and iOS devices are now synced using Finder.

What do I need to call in order to trigger a sync in Finder?

  • Did you try just changing iTunes to Music in your code? Also, devices were a part of Finder long before macOS Catalina. – user3439894 Oct 13 '19 at 9:54
  • @user3439894 - Yes - I did try using "Music". iPhones and iPads etc didn't appear in Finder prior to Catalina. – DarkHeart Oct 13 '19 at 10:42
  • I meant the Devices category in Finder, i.e. Finder > Preferences > Sidebar > Devices not which devices show or not, sorry for any confusion. So when you used Music in the code, what happened, what was logged? – user3439894 Oct 13 '19 at 10:49
  • @user3439894 - Right - I thought you meant as a managed device (as in iTunes) . Sorry. – DarkHeart Oct 13 '19 at 11:00
  • @user3439894 - I've added the output to the question – DarkHeart Oct 13 '19 at 11:04
3

I expanded on dyindude's answer to make a single script that opens Finder, navigates to your device in the sidebar, waits for the sync button to appear, and clicks it. This assume's your device is named iPhone:

tell application "Finder" to open ("/" as POSIX file)

tell application "System Events" to tell outline 1 of scroll area 1 of splitter group 1 of window 1 of application process "Finder"
    set theElements to first UI element of every row whose name is "iPhone"
    repeat with e in theElements
        try
            if name of e is "iPhone" then
                tell e to perform action "AXOpen"
                exit repeat
            end if
        end try
    end repeat
end tell

tell application "System Events" to tell application process "Finder"
    repeat until button "Sync" of splitter group 1 of splitter group 1 of window "iPhone" exists
    end repeat

    click button "Sync" of splitter group 1 of splitter group 1 of window "iPhone"
end tell
2

This Applescript will click the "Sync" button in Finder on a window that already has the device open:

tell application "System Events" to tell application process "Finder"
   click button "Sync" of splitter group 1 of splitter group 1 of window "device name"
end tell

The following Applescript will navigate "window 1" of Finder to the device named "device name", where the "Sync" button is located.

tell application "System Events" to tell outline 1 of scroll area 1 of splitter group 1 of window 1 of application process "Finder"
set theElements to first UI element of every row whose name is "device name"
        repeat with e in theElements
            try
                if name of e is "device name" then
                tell e to perform action "AXOpen"
                exit repeat
                end if
            end try
        end repeat
end tell

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .