I am getting following error for the script below. Please help
error "System Events got an error: Can’t get menu bar item \"File\" of process \"iTunes\"." number -1728 from menu bar item "File" of process "iTunes"
Script I wrote
tell application "iTunes"
activate
tell application "System Events"
tell process "iTunes"
click menu item "Sync \"iPhone\"" of menu item "Devices" of menu bar item "File"
end tell
end tell
end tell
Best Answer
This works for me to sync my iPhone in iTunes:
click menu item 1
can also be e.g.,click menu item "Sync “Iam’s iPhone”"
Note that the value of the
delay
command(s) may need to be adjusted for your system, and or additionaldelay
commands may or may not be needed. Adjust values of and or add/remove thedelay
commands as appropriate.Note: The example AppleScript code is just that and does not employ any error handling and is meant only to show one of many ways accomplish a task. The onus is always upon the User to add/use appropriate error handling as needed/wanted.