Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Preserve 'my card' in Address Book after iSync over .mac' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Preserve 'my card' in Address Book after iSync over .mac
Authored by: Christian Leue on Nov 20, '03 08:07:16AM

Yes, the "idle" event seems like the correct construction. But your sample code does not work for me. It triggers the event once at the beginning of the sync, "isSynching" remains true, and then never gets invoked again. Looks like I will read up on it...

Cheers,
Christian



[ Reply to This | # ]
Preserve 'my card' in Address Book after iSync over .mac
Authored by: Christian Leue on Nov 20, '03 08:32:06AM
Ok, the problem was just that I did not check the option "Do not quit automatically" when saving the script as an application. Also, it seems that it was necessary to declare the variables globally. So, to sum it up (and to include the good previous suggestion of terminating iSync when it's all over), this is the version I am using now:

global CurrentMyCard, isSynching

on idle
	try
		tell application "iSync" to set isSynching to syncing
		if isSynching is false then
			tell application "iSync" to quit
			tell application "Address Book"
				if my card is not CurrentMyCard then
					set my card to CurrentMyCard
					save addressbook
				end if
			end tell
			quit
		end if
	end try
	return 5
end idle

on run
	try
		tell application "Address Book" to set CurrentMyCard to my card
		set isSynching to true
		tell application "iSync" to synchronize
		idle
	end try
end run


[ Reply to This | # ]