AppleScript question

B

BB

I'm working on an AppleScript where I want to select all events in the
calendar without any category set.

I've tried "get every event where category = {}" but I'm not getting the
result I'm expecting.

Anyone who knows how to do this properly?

Thanks,

-Bo
 
B

Barry Wainwright

I'm working on an AppleScript where I want to select all events in the
calendar without any category set.

I've tried "get every event where category = {}" but I'm not getting the
result I'm expecting.

Anyone who knows how to do this properly?

Thanks,

-Bo

Close. Try this:

Every event where it's category is {}
 
P

Paul Berkowitz

Close. Try this:

Every event where it's category is {}

It's true that works, thanks to AppleScript's easy-going nature. But it sill
offends my less easy-going nature. ;-) It makes me feel better to see it as:

get every event where its category = {}

(No apostrophe in "its" if you're wondering... ;-)

--
Paul Berkowitz
MVP Entourage
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 Entourage you are using - **2004**, X
or 2001. It's often impossible to answer your questions otherwise.
 
B

BB

It's true that works, thanks to AppleScript's easy-going nature. But it sill
offends my less easy-going nature. ;-) It makes me feel better to see it as:

get every event where its category = {}

(No apostrophe in "its" if you're wondering... ;-)

Thanks a lot! Far too simple to figure it out :)

I also tried "get every event whose category = {}", but that didn't work
either. I don't really understand why, so please enlighten me.

Thanks again,

-Bo
 
P

Paul Berkowitz

Thanks a lot! Far too simple to figure it out :)

I also tried "get every event whose category = {}", but that didn't work
either. I don't really understand why, so please enlighten me.

That's a little more complicated. You probably realize that 'whose' will
work for every other property in Entourage, except 'category'. ('account'
used to be a problem too.) So why not 'category'.

When Dan implemented 'category', he used the same term for the _class_
'category' and for the _property_ 'category' - which is a property of
contact, group, message, event, task, note, etc. AppleScript can get
confused when this happens- the class, or application property, gets
priority over an object's (element's) property. The 'tell' block is still
directed to the application "Microsoft Entourage". So the script thinks
you're asking for the 'category' [property] of the application "Microsoft
Entourage". And the application doesn't have a category property - so you
get an error.

By using 'where its' - which is a synonym for 'whose' (you can use it
anywhere you might use 'whose' - see the AppleScript Language Guide) you are
specifying by 'its' that you might the object - 'event' - just referred to,
and not the application. So it works.

Dan later regretted that he hadn't used a different term, such as 'category
list' for the category-property of event, task, etc. You'll notice in
Entourage 2004 that that's what's been done with the new 'project': the
class is called 'project', but the property of event, task, etc. is called
'project list'. So you can use 'whose' with

every event whose project list = {} without error.

Not so for 'category' property: you need 'where its'.

--
Paul Berkowitz
MVP Entourage
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 Entourage you are using - **2004**, X
or 2001. It's often impossible to answer your questions otherwise.
 
B

BB

Thanks a lot! Far too simple to figure it out :)

I also tried "get every event whose category = {}", but that didn't work
either. I don't really understand why, so please enlighten me.

That's a little more complicated. You probably realize that 'whose' will
work for every other property in Entourage, except 'category'. ('account'
used to be a problem too.) So why not 'category'.

When Dan implemented 'category', he used the same term for the _class_
'category' and for the _property_ 'category' - which is a property of
contact, group, message, event, task, note, etc. AppleScript can get
confused when this happens- the class, or application property, gets
priority over an object's (element's) property. The 'tell' block is still
directed to the application "Microsoft Entourage". So the script thinks
you're asking for the 'category' [property] of the application "Microsoft
Entourage". And the application doesn't have a category property - so you
get an error.

By using 'where its' - which is a synonym for 'whose' (you can use it
anywhere you might use 'whose' - see the AppleScript Language Guide) you are
specifying by 'its' that you might the object - 'event' - just referred to,
and not the application. So it works.

Dan later regretted that he hadn't used a different term, such as 'category
list' for the category-property of event, task, etc. You'll notice in
Entourage 2004 that that's what's been done with the new 'project': the
class is called 'project', but the property of event, task, etc. is called
'project list'. So you can use 'whose' with

every event whose project list = {} without error.

Not so for 'category' property: you need 'where its'.

Thank you again. My engineering brain couldn't make sense of it. Now it can
;-)

-Bo
 
B

Barry Wainwright

It's true that works, thanks to AppleScript's easy-going nature. But it sill
offends my less easy-going nature. ;-) It makes me feel better to see it as:

get every event where its category = {}

(No apostrophe in "its" if you're wondering... ;-)

Absolutely right - that was just a typo on my part.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top