Applescript to change event categories

J

joel

I am trying to create an Applescript that can check the category of all
calendar events, and change those that are 'None' to a different
category ('Work'). I fully admit I am an Applescript novice, but I have
tried a number of things, but none have worked. Could someone possibly
help me out in putting that together?
 
P

Paul Berkowitz

I am trying to create an Applescript that can check the category of all
calendar events, and change those that are 'None' to a different
category ('Work'). I fully admit I am an Applescript novice, but I have
tried a number of things, but none have worked. Could someone possibly
help me out in putting that together?

It's a one-liner, Joel:

tell application "Microsoft Entourage"
set category of every event where its category is {} to {category
"Work"}
end tell


You've got to know three things:

1. The category property of events (and other objects) is a list of
categories (since objects can have more than one category).
2. "None" is not actually the name of a category : it just means 'no
categories", i.e. an empty list {}
3. You have to say 'where its' not 'whose' in this context; see the
thread "Searching for AppleScript references or object model" here for the
reason. (i.e. filter by Subject is ...)

(You could also do it more laboriously in a repeat loop but this method is
much neater - all in one fell swoop.)

--
Paul Berkowitz
MVP MacOffice
Entourage FAQ Page: <http://www.entourage.mvps.org/faq/index.html>
AppleScripts for Entourage: <http://macscripter.net/scriptbuilders/>

Please "Reply To Newsgroup" to reply to this message. Emails will be
ignored.

PLEASE always state which version of Microsoft Office you are using -
**2004**, X or 2001. It's often impossible to answer your questions
otherwise.
 
J

joel

None is not actually a category!! Doh! That was what was tripping me
up! I was banging my head against the wall with that one, and the
answer was so simple! I think I was indeed using 'whose' as well.
Thanks for the tip on the searching for applescript references.
Excellent info.

Thanks!!!
 
Top