Entourage 2004 Calendar Conflict Notification?

C

Cygnus X-1

Has anyone written a script for Entourage 2004 to check for calendar
scheduling conflicts? I think it is one of the products glaring omissions on
an otherwise excellent product.
 
B

Barry Wainwright

Has anyone written a script for Entourage 2004 to check for calendar
scheduling conflicts? I think it is one of the products glaring omissions on
an otherwise excellent product.

It is quite possible to set up a script to do this (and relatively easy),
but it could be dreadfully slow...

This script will assign a category ³Calendar Conflict² to all such events
and you could then search for this category with an advanced find or a
custom view.

It will run very slowly though ­ if you have 100 timed events it has to up
to 30,000 comparisons!

Save the script as a compiled script & put it in the ŒEntourage Script Menu
Items¹ folder in your ŒMicrosoft User Data¹ folder. The script can be
manually run from the menu or called as an action in a mail rule.


set logFilePath to ((path to library folder from user domain) as text) &
"Logs:com.barryw.CalendarConflictCheck.log"
try
set logFile to open for access logFilePath with write permission
set eof logFile to 0
on error errmess
display dialog "an error ocurred:" & return & errmess buttons {"OK"}
default button 1 with icon stop
close access logFilePath
beep
return
end try
tell application "Console" to open logFilePath
set t1 to current date
write "+++++++++++++++++++++++++" & return to logFile
write "Calendar Confilct Checker Script" & return to logFile
write "Script Run started: " & t1 & return to logFile
write "+++++++++++++++++++++++++" & return to logFile

tell application "Microsoft Entourage"
if not (exists category "Calendar Conflict") then make new category with
properties {name:"Calendar Conflict", color:{60928, 0, 0}}
set timedEvents to every event whose all day event is false
set eventCount to 100 --count timedEvents
write "Events to check: " & eventCount - 1 & return to logFile
repeat with x from 1 to eventCount - 1
write "checking event " & x & " - " & (get subject of item x of
timedEvents) & return to logFile
tell item x of timedEvents to set {Sx, Ex} to {start time, end time}
repeat with y from x + 1 to eventCount
tell item y of timedEvents to set {Sy, Ey} to {start time, end
time}
if ((Sy < Ex) and (Sy „ Sx)) or ((Ey > Sx) and (Ey ¾ Ex)) or
((Sy < Sx) and (Ey > Ex)) then
set category of item x of timedEvents to {category "Calendar
Conflict"} & category of event x
set category of item y of timedEvents to {category "Calendar
Conflict"} & category of event y
end if
end repeat
end repeat
end tell
set t2 to current date
write "+++++++++++++++++++++++++" & return to logFile
write "Script Run ended: " & t2 & return to logFile
write "time taken: " & t2 - t1 & " seconds" & return to logFile
write "+++++++++++++++++++++++++" & return to logFile
close access logFile
 
B

Barry Wainwright

Oops!

I left a line in that restricted the checks to just the first 100 events ­
done to speed up the testing. Here¹s the full script without the limitation.

set logFilePath to ((path to library folder from user domain) as text) &
"Logs:com.barryw.CalendarConflictCheck.log"
try
set logFile to open for access logFilePath with write permission
set eof logFile to 0
on error errmess
display dialog "an error ocurred:" & return & errmess buttons {"OK"}
default button 1 with icon stop
close access logFilePath
beep
return
end try
tell application "Console" to open logFilePath
set t1 to current date
write "+++++++++++++++++++++++++" & return to logFile
write "Calendar Confilct Checker Script" & return to logFile
write "Script Run started: " & t1 & return to logFile
write "+++++++++++++++++++++++++" & return to logFile

tell application "Microsoft Entourage"
if not (exists category "Calendar Conflict") then make new category with
properties {name:"Calendar Conflict", color:{60928, 0, 0}}
set timedEvents to every event whose all day event is false
set eventCount to count timedEvents
write "Events to check: " & eventCount - 1 & return to logFile
repeat with x from 1 to eventCount - 1
write "checking event " & x & " - " & (get subject of item x of
timedEvents) & return to logFile
tell item x of timedEvents to set {Sx, Ex} to {start time, end time}
repeat with y from x + 1 to eventCount
tell item y of timedEvents to set {Sy, Ey} to {start time, end
time}
if ((Sy < Ex) and (Sy „ Sx)) or ((Ey > Sx) and (Ey ¾ Ex)) or
((Sy < Sx) and (Ey > Ex)) then
set category of item x of timedEvents to {category "Calendar
Conflict"} & category of event x
set category of item y of timedEvents to {category "Calendar
Conflict"} & category of event y
end if
end repeat
end repeat
end tell
set t2 to current date
write "+++++++++++++++++++++++++" & return to logFile
write "Script Run ended: " & t2 & return to logFile
write "time taken: " & t2 - t1 & " seconds" & return to logFile
write "+++++++++++++++++++++++++" & return to logFile
close access logFile


--
Barry Wainwright
Microsoft MVP (see http://mvp.support.microsoft.com for details)
Seen the All-New Entourage Help Pages? - Check them out:
<http://www.entourage.mvps.org/>



From: Barry Wainwright <[email protected]>
Newsgroups: microsoft.public.mac.office.entourage
Date: Thu, 28 Apr 2005 16:58:42 +0100
Subject: Re: Entourage 2004 Calendar Conflict Notification?

Has anyone written a script for Entourage 2004 to check for calendar
scheduling conflicts? I think it is one of the products glaring omissions on
an otherwise excellent product.

It is quite possible to set up a script to do this (and relatively easy),
but it could be dreadfully slow...

This script will assign a category ³Calendar Conflict² to all such events
and you could then search for this category with an advanced find or a
custom view.

It will run very slowly though ­ if you have 100 timed events it has to up
to 30,000 comparisons!

Save the script as a compiled script & put it in the ŒEntourage Script Menu
Items¹ folder in your ŒMicrosoft User Data¹ folder. The script can be
manually run from the menu or called as an action in a mail rule.
 
P

Paul Berkowitz

Has anyone written a script for Entourage 2004 to check for calendar
scheduling conflicts? I think it is one of the products glaring omissions on
an otherwise excellent product.

The usual problems with conflicts involve recurring events. Barry's script
doesn't deal with those. It takes about 2000 lines o more of AppleScript
code
to parse the recurrence strings. You then have to check every single
recurring event in the calendar whose initial occurrence predates the
specified time, and work your way through each one until you hot the date or
terminate. This can take a very long time. One of these days Entourage will
perhaps provide a script command that can check for occurrences within a
time slice, just like the Calendar itself display a month or a week or a day
at a time. Until then, you're probably out of luck, unless someone wants to
devote 3 months or so to writing the parsing routines.


--
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.
 
B

Barry Wainwright

The usual problems with conflicts involve recurring events. Barry's script
doesn't deal with those. It takes about 2000 lines o more of AppleScript code
to parse the recurrence strings. You then have to check every single
recurring event in the calendar whose initial occurrence predates the
specified time, and work your way through each one until you hot the date or
terminate. This can take a very long time. One of these days Entourage will
perhaps provide a script command that can check for occurrences within a time
slice, just like the Calendar itself display a month or a week or a day at a
time. Until then, you're probably out of luck, unless someone wants to devote
3 months or so to writing the parsing routines.

Not me!
 
Top