|
|
Preserve 'my card' in Address Book after iSync over .mac
One thing is that you are probably better off using an idle handler than a repeat loop and sleep combo. That's basically what the idle handler was created for in AppleScript. Here's your script converted over to using an idle handler: on idle -- wait for sync to finish try tell application "iSync" to set isSynching to syncing if isSynching is false then -- tell 'em who's the boss if iSync changed it tell application "Address Book" set NewCurrentMyCard to my card if NewCurrentMyCard is not CurrentMyCard then set my card to CurrentMyCard save addressbook end if end tell quit end if end try return 1 end idle on run try -- pick up current "my card" tell application "Address Book" to set CurrentMyCard to my card -- invoke a sync tell application "iSync" to synchronize set isSynching to true end try idle end run
Preserve 'my card' in Address Book after iSync over .mac
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...
Preserve 'my card' in Address Book after iSync over .mac
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:
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.19 seconds |
|