i’m an inexperienced applescripter. but, i have tinkered with it over the years.
my task is i originally wanted to be able to link to an iCal event from another program (VooDoo Pad) such that clicking on this link would open iCal and select a specific event anywhere on any available calendar.
i found only two URLs that called iCal: ical:// and webcal://
webcal:// appeared to try and subscribe me to a calendar, and i’m not quite sure what iCal:// does.
if anyone knows what iCal:// is for AND how to format the complete URL, i’d appreciate it.
being stumped for the moment, i began trying to applescript the selection. but, i’m still bumping into some trouble.
does anyone know of a way to applescript the selection of an event (from another program)…something like:
tell application "iCal"
activate
-- i need some help here defining an event
--i'm not sure how go get the UID of an event
--or if that would even work
show someEvent
end tell
or conversely return a result from a selected event from within iCal…something like:
tell application "iCal"
set selected event to variable
end tell
tell application "VooDoo Pad"
URL://variable
end tell
i hope my pseudocode is clear enough to get the idea across.
There are several ways to form a reference to an event. Here’s one that searches for an event by summary:
tell application “iCal”
set the_cal to (first calendar whose title is “Home”)
set the_event to (first event of the_cal whose summary is “Event2”)
show the_event
end tell
It depends on what’s in your url string I think and what you’re trying to do.
There’s no selection, but you can workaround this with the macro like ui scripting. The following give you a reference to a selected event:
tell application “iCal”
activate
set the_cal to (first calendar whose title is “Home”)
end tell
tell application “System Events”
tell process “iCal”
keystroke return
keystroke “c” with command down – use ‘using’ instead of ‘with’ in Panther
end tell
end tell
tell application “iCal”
activate
set the_clip to the clipboard
set event_ref to (first event of the_cal whose summary is the_clip)
end tell
This has nothing to do with your original ‘show’ event because if the event is selected, then it is shown.
thanks. i’ll play with that for a while. i may get this working.
but, one bit of confusion i sense based on your last statement:
i was suggesting two separate tactics:
the first was to cause the event to ‘show’ in iCal via a 3rd party applescript (VooDoo pad is scriptable). in this case, the event would not be selected yet.
the second was to manually select (show) the event in iCal–run a script to get the reference, and compose a vaild call that could be pasted somewhere in the 3rd party app as a URL.
your tip looks like i’ll be attacking tactic #2
or maybe you did understand that.
in any case thanks…you’ve given me something else to toil away at.