Re: Test for event in Entourage
Re: Test for event in Entourage
- Subject: Re: Test for event in Entourage
- From: Paul Berkowitz <email@hidden>
- Date: Tue, 09 Mar 2004 13:08:47 -0800
On 3/9/04 12:22 PM, "Jeremy Reichman" <email@hidden> wrote:
>
I'd like to test to see whether an event exists in Entourage before I
>
attempt to create a new, possibly duplicate, event. I've had some
>
problems constructing the test.
>
>
Has anyone already tried to do this? How did you construct your test
>
when you knew several properties about an event, but didn't know
>
whether it already existed?
>
>
For my example, let's assume that I know at least the following about
>
the event:
>
>
* subject (name)
>
* start time
>
>
If I know no event with those two properties exists, I'd like to create
>
a new event that matches. Not knowing the GUID or ID of the event ahead
>
of time seems to put a damper on my ability to find the event (all of
>
my attempts either fail or time out), if it's already in the database.
>
>
I've looked over a couple of somewhat-related scripts at
>
MacScripter.net, but not found anything that helped me.
set theSubject to "Some Event Name"
set theStartTime to date "3/12/2004 10:00 AM"
tell application "Microsoft Entourage"
set sameEvents to every event whose subject is theSubject and start time
is theStartTime
if sameEvents = {} then
make new event with properties {subject:theSubject , startTime:
theStartTime, end time:(theStartTime + (1 * hours))}
end if
end tell
Try to avoid throwing too many criteria into the whose clause: 2, as obove,
is powerful and pretty fast (depedning how many thousands of events are in
the database). More than 4 might cause an Out Of memory error if there are
lots of events to filter. Delete old events when possible. Two or three
criteria should be fine. I've used 4 occaisonally.
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.