Making a new event (the AppleScript class for what's also called "calendar event") is the same as making a new contact, including consideration of the new multiple calendars if you have an Exchange account, but with fewer properties available.
tell application "Microsoft Entourage"
set newEvent to make new event with properties {subject:¬
"New Event", start time:¬
date "1/8/07 10 am", end time:¬
date "1/8/07 11 am", remind time:15, location:¬
"My event", content:"Some notes here." category:¬
{category "Recreation"}}
end tellYou can enter the format for short dates on your computer for the start time and end time properties, and Macintosh Script Editor compiles them to date objects.
tell application "Microsoft Entourage"
set newEvent to make new event with properties {subject:¬
"New Event", start time:¬
date "Monday, January 8, 2007 10:00:00 AM", end time:¬
date "Monday, January 8, 2007 11:00:00 AM", remind time:15, location:¬
"My event", content:"Some notes here.", category:¬
{category "Recreation"}}
end tellThere are a number of properties in the dictionary available just for Microsoft Exchange events (not used above), and one property (to recipients) used for making invitations. Be aware that if you include to recipients, the invitation gets sent off as an e-mail message the instant the event is made.
If you set all day event to true, the start time property needs to be set to midnight, and the end time property to midnight of the next day (or several days later if making a multi-day event: always the midnight just after the last day of the event). Microsoft Entourage will correct it, but maybe not on quite the day you expect, so it's best to ensure you get it right.
To make a recurring event (recurring:true), get an appropriate recurrence string off of an event of the same recurrence pattern that you've made in the UI. It's too complicated to learn all of the rules (there is an RFC that details them: it's called an "iCal recurrence"). You may want to avoid recurrence unless you can take one from an existing event and set that.
Opening an event is the same as opening anything else in the Entourage database. You identify the event and open it. For more information about opening items, see Create or open a contact.
The main difference is that you will usually have more than one event with the same name, so getting it by name only (event "Meeting") is not recommended. It will only get the first one created with that name.
You need a
whose
clause that filters on both the name and a time slot. It's also not recommended to require an exact time, just in case you've got it not quite right. Better is to specify a whole day or week.
tell application "Microsoft Entourage" set theEvent to first event whose subject is "My Event" and ¬ start time ? date "Monday, January 8, 2007 12:00:00 AM" and ¬ start time < date "Tuesday, January 9, 2007 12:00:00 AM" end tell
If you have a Microsoft Exchange account, you need to read about multiple address books and calendars. For more information, see Create or open a contact. Everything about address books and contacts applies equally to calendars and events.


