• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iCal question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iCal question


  • Subject: Re: iCal question
  • From: Chris Page <email@hidden>
  • Date: Tue, 25 Nov 2003 22:00:09 -0800

On Nov 24, 2003, at 14:46, Christopher Nebel wrote:

> Sort of. iCal's "whose" support works fine for one-shot events, but
> because of how they model recurring events, you pretty much have
> handle them yourself. You can go snarf Scott Tooker's "Today's
> Schedule" Konfabulator widget
> <http://www.widgetgallery.com/dl.php?widget=25887> and see how he does
> it. (He griped a lot about how much code he had to write.) For what
> it's worth, I've never seen any scheduler that does a decent job of
> scripting this -- if anyone has an example, I'd love to see it.

In Palm Desktop it's easy enough to get items for a particular date
using a 'calendar day', which contains items that appear on a
particular date. You can look up calendar days using a date or a date
string. Is this the kind of thing you're referring to?

I considered supporting this via 'whose', but didn't have time, and
it's easy enough to work with calendar days.

Here's a sample script I wrote that speaks today's events. It gets the
events for the current date with 'events of calendar day (current
date)'.

set eventNames to {}
set eventTimes to {}

tell application "Palm Desktop"
tell events of calendar day (current date)
if (count) > 0 then
set eventNames to title
set eventTimes to start time
set eventAllDayFlags to all day event
end if
end tell
end tell

if length of eventNames > 0 then
if length of eventNames > 1 then
set eventSuffix to (length of eventNames as string) & " events:"
else
set eventSuffix to "event:"
end if
say "Today you have the following " & eventSuffix
repeat with i from 1 to length of eventNames
set eventDescription to item i of eventNames
if item i of eventAllDayFlags then
set eventDescription to "All day you have " & eventDescription
else
set eventDescription to "At " & SpeechTimeString(item i of
eventTimes) & " you have " & eventDescription
end if
say eventDescription
end repeat
else
say "You have no events today."
end if

-- The Ttime stringU property of a date returns a string that TsayU
will pronounce poorly. For example,
-- "06:30:00 AM" will be pronounced as "six thirty o'clock am". So, we
produce our own time string,
-- formatted for better speech, e.g., "6 30 A M", is pronounced Rsix
thirty aye emS.

to SpeechTimeString(d)
local theTime, hour, minute, suffix, timeStringSuffix, timeString

set theTime to time of d
set hour to theTime div hours
set minute to (theTime - (hour * hours)) div minutes

-- append am/pm suffix, if any

set rawTimeString to time string of d
if rawTimeString contains "AM" then
set timeStringSuffix to " A M"
if hour = 0 then set hour to 12 -- convert to 12-hour time
else if rawTimeString contains "PM" then
set timeStringSuffix to " P M"
set hour to hour mod 12 -- convert to 12-hour time
else
if minute = 0 then
set timeStringSuffix to " hundred"
else
set timeStringSuffix to ""
end if
end if

-- build the string, omitting minutes if zero

set timeString to hour as string
if minute - 0 then
set timeString to timeString & " " & minute
end if
set timeString to timeString & timeStringSuffix

return timeString

end SpeechTimeString

--
Chris Page - Software Wrangler - palmOne, Inc.

Dylan + You = Code
<http://www.gwydiondylan.org/>
<http://www.cafepress.com/chrispage>
_______________________________________________
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.

References: 
 >iCal question (From: David Hanauer <email@hidden>)
 >Re: iCal question (From: Christopher Nebel <email@hidden>)

  • Prev by Date: Re: [OT] Question to list manager
  • Next by Date: Accessing Tabs in Safari
  • Previous by thread: Re: iCal question
  • Next by thread: Re: iCal question
  • Index(es):
    • Date
    • Thread