itunes - iTunes Manual Backup - Wifi Sync Multiple Devices

Hey All,

Objective

  • manually initiate backup of devices from iTunes through applescript.

Issues:

  • I can start the backup process for one but the subsequent devices fail.

Info:

  • itunes 12, macOS 10.14
  • wifi sync enabled
  • the UI does have an interface
    – File > Devices > Backup (but you have to select each device for it to be enabled)
    – Second Mouse click on device and select backup on each device is also available but not useable if UI isn’t accessible

Question:

  • Is there a way to achieve the backup through AppleScript on multiple devices?
  • also is there another command that does a backup instead of sync. Since update seems to do a sync.

Code:
This is what i have working but the second device shows an error.


set devices to {"deviceName1", "deviceName2"}
repeat with theDevice in devices
	tell application "iTunes"
		try
			update theDevice
		on error
			say "Backup error on" & theDevice
		end try
	end tell
	delay 20
end repeat