Re: Still no help for iCal
Re: Still no help for iCal
- Subject: Re: Still no help for iCal
- From: Ron Hunsinger <email@hidden>
- Date: Tue, 22 Apr 2008 14:11:14 -0700
Title: Re: Still no help for iCal
At 6:08 PM -0500 4/21/08, "C. David Castillo Hernández"
wrote:
I run a group that have periodic meetings
[snip]
I used to have this workflow that made this automatically for me.
Since I bought a new laptop (one with leopard) this stopped working. I
think I've isolated the problem to when a date is included. My
original workflow looked like this:
1. Find events in iCal whose calendar is
"Group" and whose start date is "next week"
[snip]
It worked flawlessly in my Tiger iBook.
Now it doesn't work,
The problem is that your periodic meetings are entered as
recurring events. The start date and end date for a recurring event
are those of its first occurrence. Your script worked fine for the
first few months, when all of your events were still in their first
occurrences, but now the events you want to find are second and third
occurrences, which iCal won't find based on start date.
This isn't a Leopard vs. Tiger thing. The same problem occurs in
both. And nobody else saw the problem, because they either weren't
testing for recurring events, or tested when the next recurrence was
still the first recurrence, or just didn't notice that recurrences
weren't showing up in the result.
I looked at writing an applescript to replace your "Find
Events in iCal" step. The problem is parsing the recurrence
string, whose format is defined by RFC 2445 (see
http://www.ietf.org/rfc/rfc2445.txt). That doesn't look like an easy
chore.
Which means someone has probably done it and posted their
solution. Indeed, a Google search turned up
<http://bbs.macscripter.net/viewtopic.php?pid=94958> which,
while not Automator-specific, does at least cover the difficult
part.
I won't repeat their script here, for all the obvious reasons. (I
don't own it; any problems with it should be taken up there; and if
this works you should definitely send your thanks in their direction,
because they did all the hard work.) But I will tell you how to tailor
it to your needs.
Begin your workflow with a "Find iCal items" step,
customized to return a list of events, but do not filter on
date.
Follow that in your workflow with a new "Run AppleScript"
step which will do the date filtering. Replace the boilerplate script
with the scriptlet from the MacScripter website. (In my testing I used
the script from the first message in the thread.) Then append the
following handler at the end:
-- ----------------- Begin Automator Glue
----------------------
-- ----------------- Input: a list of iCal
events
-- ----------------- Output: a list of iCal
events
on run {input,
parameters}
set output to {}
set tomorrow to (current date) + 1 * days
set time of tomorrow to 0
set nextweek to tomorrow + 7 * days
tell application "iCal"
repeat
with
anEvent
in
input
set nextRecurrence to my getNextRecurrence(recurrence of anEvent,
start date
of
anEvent,
tomorrow)
if (nextRecurrence is missing value)
then
-- the
event has expired (or is expiring today)
else
if (nextRecurrence comes before nextweek) then
set end
of
output
to
contents
of
anEvent
end
if
end
repeat
end tell
return output
end run
-- ----------------- Begin Automator Glue
----------------------
This gives you a filter that will select events that occur *or
will reoccur* during the seven days starting tomorrow. (I assume it's
too late to remind them about today's events.)
I tested that on both Tiger and Leopard. Of course, this only
selects the right events. They still have the wrong start date. In the
mail message you compose from this, you can give recipients the event
summary, but tell them to go to the shared calendar to get the correct
date.
-Ron Hunsinger
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden