|
|
Batch append data to the Notes field on Address Book cards
Thanks for the tip! I tried it and added the command "save thePerson" like dopey suggested and it works fine. He suggested putting the save command between the "end repeat" and "end tell" statements which works, but it seemed to me like the command should be just before the "end repeat" statement so it applies to each person in each iteration of the repeat loop. Either method works (which doesn't make sense to me), but oh well. One thing to note is that the "Result" value in the AppleScript Editor displays "missing value". Everything still works, but I'm curious to know why it is giving that error.
Here is my code that works:
For what it's worth, I found this page trying to figure out a way to delete all notes from selected Address Book entries. I modified the code above to do this, and it works like a charm (but also returns the "missing value" note in the AppleScript editor):
Batch append data to the Notes field on Address Book cards
here's an expanded and somewhat cleaner version of the script. This allows adding or deleting individual notes, as well as clearing the entire note list for the selected items.
The reason you were getting a 'missing value' result in Script Editor is that the 'save' command is a shortcut for 'save addressbook', and is used to save the entire book. It does not return a result (hence the 'missing value' result that you're seeing). I'm actually surprised your version not throwing an error - 'save thePerson' is meaningless in context - but no sense looking a gift horse in the mouth.
Batch append data to the Notes field on Address Book cards
Thanks for posting - that's handy to have the add and delete functionality combined. I tried the code and it works great, but still gives me the same "missing value" error. Could it just be something with my machine? I wouldn't think so, but you never know...
Batch append data to the Notes field on Address Book cards
as I said, the 'missing value' comes from the 'save' line. in Address Book, the 'save' command returns no value (i.e., it gives 'missing value'), and since it's the last active line in the script that's what the script returns when you run it. don't worry about it. if it really bugs you, add the line "return" at the end of the script, and you'll get a different value. |
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.43 seconds |
|