I’m trying to build a script that will initiate a MobileMe sync, and then see when it finishes to continue. This is the portion I’ve been working on, it works just fine but I don’t really like relying on the UI to determine if it is done. I’ve searched the forum for other similar scripts, but there isn’t anything that fits my needs. Does anyone have any ideas? Thanks!
tell application "System Events"
tell process "SystemUIServer"
tell menu bar 1
set SyncMBI to (first menu bar item whose description contains "Sync")
click SyncMBI
tell SyncMBI
tell menu 1
set SyncButton to (first menu item whose name contains "Sync Now")
click SyncButton
set isFin to false
repeat until isFin
try
click SyncMBI
delay 1
set cancelB to (first menu item whose name contains "Cancel")
delay 1
click SyncMBI
on error
set isFin to true
end try
end repeat
end tell
end tell
end tell
end tell
end tell