Can I import from an iCal file?

Support, Questions and Suggestions for the FM7 Version of CC Calendar.
Posts: 10
Joined: Wed Jan 12, 2005 9:54 pm
PostPosted: Wed Jan 12, 2005 9:59 pm
I have just purchased CC Calendar in order to conveniently share my calendars with MAC & PC Users. My current calendars are on MAC iCal. Can I import them somehow?
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Thu Jan 13, 2005 5:24 am
Unfortunately, Ian, we don't have anything in place to import iCal files. That isn't to say you couldn't write something...

You wouldn't exactly import an iCal file, you'd loop through the contents of one and create CC Calendar appointments from it.

Export one of your calendars from iCal and the try dragging the resulting .ics file to FileMaker 7. You'll see that you get a ton of records, every 8 to 12 of them making up one appointment. You could write a script to loop through these looking for the telltale 'VEVENT" and "DTStart" strings and build new records out of these.

Here is a hint: when you run across the Date/Time start and end fields, you'll need to decode both the date and time from a string like this:

DTSTART;VALUE=DATE-TIME:20030709T083000

...you can start with the following calc:
Code: Select all
Let ( [

string = f1 ; // Replace f1 with your field name.

icalfield = LeftWords ( string; 1 ) ;

datetimestring = If ( icalfield = "DTSTART" ; RightWords ( string ; 1 ) ) ;

datereturned = Date ( Middle ( datetimestring ; 5 ; 2 ) ;  Middle ( datetimestring ; 7 ; 2 ) ; Left ( datetimestring ; 4 ) ) ;

timereturned = If ( PatternCount ( datetimestring ; "T" ) =1 ; Time ( Middle ( datetimestring ; 10 ; 2 ) ; Middle (  datetimestring ; 12 ; 2 ) ; Right ( datetimestring ; 2 ) ) )

] ;

If ( not IsEmpty ( datetimestring ) ; "Date = " & datereturned & ¶ & "Time = " & timereturned )

) // End Let

Other parts of the appointment are easier, like the appointment's description. If you have created repeating appointments in iCal, you may be best just sending that information into the appointments notes so that you can recreate the repetitions in CC Calendar after you've imported the appointments.

In any event, if you get into this, please post your results (your translation file?) here as I imagine there are others who'd really appreciate it.

Hope that gets you started.

Best,

John
John Sindelar
SeedCode
Posts: 10
Joined: Wed Jan 12, 2005 9:54 pm
PostPosted: Wed Jan 19, 2005 4:06 pm
I have written an iCal importer - including handling for Weekly & Monthly Repeats. Once I am fully happy with it, I will let you have a copy.

QUESTION: I have experimented with CCCalender iCal export, which then shows up nicely on MAC iCAL. I would like then to download it to my Palm. This works - except here are no Time Zone indicators (either general or with individual DateTime entries). This causes my Palm to think they are GMT and so it gives me Date & Times 11 hours out of wack. I may be able to tell my Palm that I want to see GMT Calendar entires. However ...

Would it be possible to get the Tine Zone indicators in the exported iCal file?
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Thu Jan 20, 2005 5:14 am
There are two areas of the .ics file which concern time zones; as you correctly pointed out, both are omitted in our iCal export. The header would have to be inserted into the .xsl file we've supplied; while it would be pretty easy to hard code some timezone stuff there, I don't think we need to.

I believe we just need to insert the time zone ID into the individual event entries. This *should* let the appointment work with the time zone already defined in your palm's calendar. To do this, insert the following string...

TZID=America/Detroit:

...right after each event's DTSTART : but before the time string. The edited portion of the calc in CC Calendar would look like this:
Code: Select all
// DateTime Start

If(IsEmpty(AppointmentsDaily::ApptTimeStart);"¶DTSTART;TZID=America/Detroit:"; "¶DTSTART;TZID=America/Detroit:") & Year(AppointmentsDaily::ApptDateStart) & Right("00" & Month(AppointmentsDaily::ApptDateStart); 2) & Right("00" & Day(AppointmentsDaily::ApptDateStart); 2) & If(IsEmpty(AppointmentsDaily::ApptTimeStart); ""; "T" & Right("00" & Hour(AppointmentsDaily::ApptTimeStart); 2) & Right("00" & Minute(AppointmentsDaily::ApptTimeStart); 2) & Right("00" & Seconds(AppointmentsDaily::ApptTimeStart); 2) & "") &

// Begin DateTime End


Obviously replace "America/Detroit" with whatever you've defined your timezone as in iCal's preferences. You can also create this time zone as a field in the calendar so that it behaves like more of a setting and is not hard coded.

The whole time zone header (reproduced below) is not needed in iCal if you've set iCal to use timezones, I imagine it would work for your palm the same way.

BTW, I'm psyched that you're working on this. I look forward to your post. I have some ideas about how we might be able to roughly "synch" these ical and palm files with CC Calendar, so I look forward to trying them out in your script.

Best,

John

--- Full TZ header, follows "publish" in the .ice file ---

BEGIN:VTIMEZONE
TZID:America/Detroit
LAST-MODIFIED:20050120T123225Z
BEGIN:STANDARD
DTSTART:20041031T060000
TZOFFSETTO:-0500
TZOFFSETFROM:+0000
TZNAME:EST
END:STANDARD
BEGIN:DAYLIGHT
DTSTART:20050403T010000
TZOFFSETTO:-0400
TZOFFSETFROM:-0500
TZNAME:EDT
END:DAYLIGHT
END:VTIMEZONE
John Sindelar
SeedCode

Return to CC Calendar (FM7/8)

Who is online

Users browsing this forum: Google [Bot] and 2 guests

(855) SEEDCODE
[email protected]
Follow us: