Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

I have a script based largely on mfero's file, found here. The script moves data from FMP to iCal via Applescript. Here is what I passed to Applescript:


BEGIN:VCALENDAR

BEGIN:VEVENT

DTSTART;VALUE=DATE:20101025T130000

DTEND;VALUE=DATE:20101025T140000

SUMMARY:Text/Text string here

VFREEBUSY:Busy

LOCATION:555 Street Ave.,  San Jose CA

DESCRIPTION:Contact: John Doe (209) 555-5555, PO # Cl 0180762866, Company Job # 10-779

END:VEVENT

END:VCALENDAR




This worked until recently.



I changed the code to this:



BEGIN:VCALENDAR

VERSION:2.0

PRODID:-//Company//NONSGML FMP database//EN

BEGIN:VEVENT

DTSTART;VALUE=DATE-TIME:20101101T130000

DTEND;VALUE=DATE-TIME:20101101T140000

SUMMARY:Text string here

LOCATION:Big College  City CA

DESCRIPTION:Contact: Doe   PO #  Company Job # 10-804

END:VEVENT

END:VCALENDAR

Changes:

1. Added a VERSION greater or equal to 2.0

2. Added a PRODID

3. Changed the DATE to DATE-TIME

4. Removed VFREEBUSY

5. Removed commas ", " in the DESCRIPTION

Changes were made based on these tools:

http://severinghaus.org/projects/icv/

http://icalvalid.cloudapp.net/Default.aspx

This new version validates in both of these tools. However, it still does not work. Did something change in the iCalendar version or format? I'm really perplexed why this would work and then all of a sudden stop.

Also, mfero's script, which once worked, no longer does.

Anyone have any insights?

Thanks.

  • Author

Is anyone else having difficulty with iCalendar markup? Not sure why my code was working for a while and recently decided to stop. Any ideas?

There is a better way to this if you are willing to code the applescript. I'll try to post something if I have time to prepare it. Otherwise the code to use for applescript goes something like this.

--Get event data from fmp

tell application "FileMaker Pro"

tell database "YOUR DATABASE NAME"

tell window 1

tell current record

set MyEvent_id to cell "PRIMARY KEY FROM YOUR EVENT TABLE"

end tell

end tell

tell table "YOUR EVENT TABLE"

tell (every record whose ¬

cell "PRIMARY KEY FIELD FROM YOUR EVENT TABLE" = MyEvent_id)

set event_name to cell "EventName_c"

set event_start to cell "EventStartDate_c"

set Event_End to cell "EventEndDate_c"

KEEP ON SETTING EVERYTHING YOU WANT TO PASS DATES HAVE A SPECIFIC FORMAT FOR ICAL

end tell

end tell

end tell

end tell

--Create new event in iCal with event data from fmp

tell application "iCal"

set event_ical to make new event at end of calendar Event_status with properties

AND ANY EXTRA FIELDS YOUR PASSING ALONG BELOW. USE CORRECT FIELD NAME FOR ICAL THEN :P AND YOUR CORRISPONDING VARIABLE FROM ABOVE

{summary:event_name, start date:date event_start, end date:date Event_End, allday event:true}

end tell

--Get id from event_ical

set Event_id to get id of event_ical

--Pass event id to fmp as foriegn key for future update reference

tell application "FileMaker Pro"

tell database "YOUR DATABASE NAME"

tell table "YOUR EVENTS TABLE"

tell (every record whose ¬

cell "YOUT EVENT PRIMARY KEY FIELD" = process_id)

set cell "IF YOU HAVE ONE MAKE A ICAL EVENT ID FIELD AND PUT HERE" to Event_id

end tell

end tell

end tell

end tell

  • Author

Thanks for your reply, ryangrg. Can you tell me why you consider this to be better?

Also, to the broader forum community, is anyone else having trouble with passing FMP data to iCal using BEGIN:VCALENDAR...END:VCALENDAR? Or, is anyone having trouble getting this file to work (it originally worked for me, but no longer does)?

The file doesn't work for me (FMPA 11, OS X 10.5.8). The .ics file is flawed and iCal won't accept it. The flaw, AFAICT, is the first line being "-n BEGIN:VCALENDAR".

One cannot help wondering: if you use AppleScript to create an event in ICal - why do you need the .ics intermediary?

  • Author

The file doesn't work for me (FMPA 11, OS X 10.5.8). The .ics file is flawed and iCal won't accept it. The flaw, AFAICT, is the first line being "-n BEGIN:VCALENDAR".

Thanks for testing, comment.

One cannot help wondering: if you use AppleScript to create an event in ICal - why do you need the .ics intermediary?

I really don't know applescript, so when I was asked to send data from FMP to iCal I looked for applescript that was already written. I tried several and failed (I don't remember where I found them or their content), so I did the next thing, which is to ask, "Is there another way of doing this?" That is when I came across the iCalendar script (c.f. first post in this thread). It worked, so that is what I used.

Your comment is well taken - "if you use AppleScript...". I'll give ryangrg's script a go.

Again, thank you for checking on mfero's file.

  • Author

There is a better way to this if you are willing to code the applescript...

ryangrg,

Thank you for the script you posted. I was not able to make it work - largely, no doubt, to my ignorance of applescript. Do you do sub-contract work? If so, can you contact me? Thanks.

Another approach would be to Export a calendar from iCal (create one for testing), with a single event. This will show you exactly what works for the ics file. Mine is a heck lot longer than what you posted. Likely much of it is not required. But also likely some of it is. Also likely that most of the top section will always be the same, so could be hard-coded.

Well Comment is right. If you can get AppleScript to do the whole thing for you that might be better - I just found it to be a lot harder. I also agree with Fenton's remark, you can easily see Apples syntax for .ics files by exporting an event from iCal. 90% of it can be stripped away since it has to do with time zones and such.

The original example file broke because AppleScript changed its encoding for the echo command. As a result the script now adds '-n ' to the first line and adds a carriage return to the last line. (The purpose of the -n flag is to prevent the terminal line feed.)

The fix is to use /bin/echo instead of echo. I'll update the original sample file.

Thanks for pointing this out.

iCalExport_v.2.fp7.zip

Edited by Guest
Updated example file

You know, I did some testing of the different versions of echo a while ago, and their output from external AppleScripts and FileMaker's Perform AppleScript (it was very hard to something that would work the same in both), that I gave up and am using "printf" now, which does not seem to have that problem.

P.S. I also included a change for timed events. iCal no longer assumes that an event is one hour in duration if it is not specified. So I had to add prompt the user for the duration of the event. This seems to work fine even if the duration goes past midnight.

  • Author

Thank you to all who replied.

@mfero - thank you for modifying your script. It may have been a simple change but I would never have found it!

@Fenton - thanks for your suggestion about creating a Test calendar and exporting it. I still presume that if I was missing something in the iCalendar markup, the validating tools mentioned above would have found it. Nonetheless, your Test calendar trick is new to me and I'm happy to add it to my toolkit.

Well Comment is right. If you can get AppleScript to do the whole thing for you that might be better - I just found it to be a lot harder.

@comment and ryangrg - It seems to be the consensus that doing this solely with AppleScript is the way to go. Do either of you have or know of samples that are open for other developers to copy? Or, would something like this be considered a paid service?

Thanks again to all. By the way, I implemented mfero's change (/bin/echo) and it works again.

Here is something that should work everything is handled in Applescript. Information must be formatted exactly like they are in the example records. Also I added in all-day event status, enter true for all day event false or empty string will return a false to the script. If you want to adapt the script into your solution just substitute you fields into the let function variables. This updates iCal in the back ground so it won't take you to the iCal app after setting it. Also if summary or description have quotes they will need escapes, you could do this by adding a calculation in the let function to modify these variables. Let me know if you have any questions.

EventToiCal.fp7.zip

Nice. The formatting requirements are easily accomplished by using Filemaker's 'time' and 'date' data types, instead of 'text'.

Yes, I was trying to keep stripped down. All so it could use an auto enter formatting calculation for time. Just watch out I don't think you can pass 01:00:00 PM it needs to be 1:00:00 PM.

  • Author

Thanks, ryangrg. I just downloaded the file and tested it out. Works very well.

Thanks!

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.