I want to assign some categories to selected contacts via a script but for some reason it's not working.The reason is that you’re not doing it right. I’m not sure how or were you got the idea that ‘properties’ is the way to set ‘category’.
Here is the snippet:
tell application "Microsoft Entourage"
set theContacts to selection
repeat with i in the theContacts
set properties of i to {category:"Personal"}
end repeat
end tell
it returns the following:
--> Microsoft Entourage got an error: Can't set properties of contact id 920 to {category:"Personal"}.
In theory this should do it...
Whose theory would that be?
set category of i to {category:"Personal"}
i, being a contact (if you’ve selected some contacts, that is) has about 53 properties. You can’t set all of them to a list of categories. What you want to set here the contact’s ‘category’ property. So do it.
You usually use ‘properties’ only when making a new element, and are specifying a number of (non-default) properties all at once, e.g.:
make new contact with properties {name:"Silly Billy", home address:{street address:"123 Flop Street", city:"Imaginary", state:"CA"}, age:123, category:{category "Personal"}}
Neither of those two conditions apply in your script.
--
Paul Berkowitz
