Monday, November 08, 2010 at 12:04 AM.
system.verbs.builtins.mainResponder.calendar.getNextAddress
on getNextAddress (adrCalendar, d=clock.now ()) {
<<Tue, May 23, 2000 at 5:45:33 PM by AR
<<Old code
<<on getNextAddress (adrCalendar, d=clock.now ())
<<Notes
<<Thu, 11 Mar 1999 20:11:57 GMT by AR
<<adrcalendar is the address of a valid calendar structure.
<<d is an optional date which defaults to clock.now ().
<<If the address corresponding to d exists, we return it.
<<Otherwise we walk forwards in time until we find an element and return its address.
<<We throw a scriptError if the calendar does not contain elements corresponding to times after d or if adrcalendar does not point to a valid non-empty calendar structure.
<<local (adrDay, dmax = mainResponder.calendar.getLastDay (adrCalendar))
<<dmax = date (date.tomorrow (dmax) - 1)
<<while (d <= dmax)
<<try
<<adrDay = mainResponder.calendar.getDayAddress (adrCalendar, d, flcreate:false)
<<if defined (adrDay^)
<<return (adrDay)
<<d = date.tomorrow (d)
<<scripterror ("Can't get the next address in the calendar because the calendar doesn't contain any elements after " + d + ".")
kernel (mrcalendar.getnextaddress)}
<<bundle //test code
<<dialog.notify (getNextAddress (@scriptingNews, date ("03/01/99")))
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.