Re: iCal alarm scripts
Re: iCal alarm scripts
- Subject: Re: iCal alarm scripts
- From: "Nigel Garvey" <email@hidden>
- Date: Fri, 15 Jan 2010 21:32:22 +0000
Josh Tishhouse wrote on Fri, 15 Jan 2010 14:51:21 -0500:
>I tried that.
>
>It didn't seem to work out so well. Here's the error message:
>
>The Script "test script.scpt" that was assigned to the event "test event"
>didn't open or didn't finish running because of the following AppleScript
>error: Can't make {} into type integer."
>
>Here's my script:
>
>on myEvent()
> set now to (current date)
> set leeway to 60 -- Allow 60 seconds for the script to respond to the
>alarm.
>
> tell application "System Events" to set myURL to URL of (path to me)
>
> tell application "iCal" to set myInstances to (open file alarms of events
>of calendars whose filepath is myURL)
> return result
My most abject apologies! That test line 'return result' was left in the
script I posted. It shouldn't be there. Here's a re-post:
on myEvent()
set now to (current date)
set leeway to 5 -- Allow, say, 5 seconds for the script to respond
to the alarm.
tell application "System Events" to set myURL to URL of (path to me)
tell application "iCal" to set myInstances to (open file alarms of
events of calendars whose filepath is myURL)
--> A list containing lists corresponding to the calendars,
containing lists
--> corresponding to the events, containing nothing or matching alarm(s).
set evntCal_Indices to {}
repeat with c from 1 to (count myInstances)
set thisCal to item c of myInstances
repeat with e from 1 to (count thisCal)
set thisEvnt to item e of thisCal
repeat with alrm from 1 to (count thisEvnt)
tell application "iCal" to set timeDiff to (start date of
event e of calendar c) + (trigger interval of item alrm of thisEvnt) *
minutes - now
if (timeDiff > -leeway) and (timeDiff < leeway) then set end
of evntCal_Indices to {e, c}
end repeat
end repeat
end repeat
return evntCal_Indices -- event/calendar index pairs.
end myEvent
set candidates to myEvent()
--> {{11, 4}} -- One candidate found: event 11 of calendar 4.
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden