AppleScript error -1728 while accessing menu
This works for me to sync my iPhone in iTunes:

tell application "iTunes"
    activate
    delay 1
    tell application "System Events"
        click menu item 1 of menu 1 of menu item "Devices" of menu 1 of menu bar item "File" of menu bar 1 of application process "iTunes"
    end tell
end tell



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 additional delay commands may or may not be needed. Adjust values of and or add/remove the delay 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.