Sync with iSync in the background

May 01, '06 07:30:00AM

Contributed by: inemo

I've got a Sony Ericsson P910i, and wanted to be able to sync it with a key combo. Since I have Butler installed, and it can run AppleScripts, I thought I'd write a script to activate iSync and synchronize.

tell application "iSync"
	activate
	synchronize
end tell
I quickly realized that the iSync window popping up is annoying. So I sought out a way to hide iSync after activating it. It turns out that Butler was waiting for the sync to finish before releasing itself for other tasks, so I needed some way of telling iSync to synchronize and not wait for the result.

Here's my solution:
tell application "iSync"
	activate
	set visible of window 1 to false
	ignoring application responses
		synchronize
	end ignoring
end tell
This script activates iSync (whether it's running or not), 'kills' (hides) the front window, then tells it to sync, without waiting for a response. The only downside is that iSync is still the frontmost application, but it'd be quick to add a system events tell that does Command-Tab to switch back to the application you were in before you initiated the sync.

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20060423115136212