ICS functions Library
katir at hindu.org
Fri Dec 4 19:57:05 EST 2009
On Dec 2, 2009, at 3:23 AM, Andre Garzia wrote:
>> I lost that library when I lost my laptop! :D
>> I will get Sivakatirswami copy and post it online. I made that
>> library ages
>> ago, I am a much better programmer now and probably would have coded it
>> differently, but it works as expected. It was very minimalistic full of
Ha! Jai Ganesha... it works and works very well. I think you forget how
clean it is and how you were into your "LISP" mode of keeping discrete
functions separate. Once I understood how they worked I was able to get
the job done easily.
JB: you can get it here:
go stack url
(Andre, suggest your get this and host it on your site?)
Notes: Andre's "documentation" does not tell the user that the library
is a substack of his main stack.
Use application browser to toplevel the vObjectLib; clone it; Rename if
you like (I did) then assign it to your own main stack:
then you can generate things like this:
# This app scans an existing calendar for events containing a specific
string, being the "tithi" designation
# for a day of the Moon phase, then uses those dates to enter another
# This allows for repeating events on, e.g. the first day of each moon
# 4PM when the department heads have a coordination meeting
# repeat loop through each entry,
set the loc of this stack to the screenloc
start using stack "KA_vObjectLib" # andre's functions in the stack script
start using stack "libUUID" # Mark's fabulous GUID lib
function buildVevent pDate, pStartTime,pEndTime
# uses Eric Chatonet's magical little group/object from timepicker.rev
# to let users choose times
put empty into gRepeatingEvent
vObjectBegin gRepeatingEvent, "VEvent"
icAddCreationDate gRepeatingEvent, (icConvertDate(the seconds))
put luiRandomUUID() into tUID
icAddDateTimeStart gRepeatingEvent, (pDate&"T"&pStartTime)
icAddTimeZoneID gRepeatingEvent, "DTSTART", "Pacific/Honolulu"
icAddSummary gRepeatingEvent, fld "Summary"
icAddDescription gRepeatingEvent, fld "Description"
icAddDateTimeEnd gRepeatingEvent, (pDate&"T"&pEndTime)
icAddTimeZoneID gRepeatingEvent, "DTEND", "Pacific/Honolulu"
icAddSequence gRepeatingEvent, "0"
icAddDateTimeStamp gRepeatingEvent, (icConvertDate(the seconds))
icAddTransparency gRepeatingEvent, "OPAQUE"
vObjectEnd gRepeatingEvent, "VEvent"
Button "Create Repeating Events..."
# repeat loop through each VEVENT in existing calendar.ics file,
# if VEVENT contains string "Sun 1" (or whatever tithi day the user
choses from the GUI)
# then build a new VEVENT
# there's more but you get the idea:
repeat for each item tEvent in tCalendar
if tEvent contains tTargetPhaseDay then
# parse out the date entry
put (lineOffset("DTSTART;VALUE=DATE:",tEvent)) into tLine
put (char -8 to -1 of line tLine of tEvent) into pDate
# build the new entry; see stack script for functions
# that call Andre vObjectLib stack functions
put buildVevent(pDate,tStartTime,tEndTime) after tNewEntries
#export tNewEntries to iCal file which user then imports
I suspect today Andre would use some of RunRev's new array magic...
But this is so transparent... I like it, redundant or not.
More information about the Use-livecode