Jump to content

ical scripted


This topic is 3409 days old. Please don't post here. Open a new topic instead.

Recommended Posts

It is possible to do with AppleScript, which can be run within a Perform AppleScript step. I can post an AppleScript, if you want to get into it. But there is some work involved. The fields must be named exactly the same as in the AppleScript (it will not automatically adjust, as FileMaker does). The "timestamp" fields must be timestamps. The fields must be on the current layout when the script runs (or specified by TO, which is also a PITA). Anyway, if you're willing, this is a good start. Create a FileMaker file with the fields named. Copy/paste into Script Editor.

tell application "FileMaker Pro Advanced"

tell current record of window 1

set dateStartTxt to cell "_cTimeStampStart"

set dateEndTxt to cell "_cTimeStampEnd"

set theSummary to cell "EventName"

set theLocation to cell "Location"

set Desc to cell "Notes"

set theAttendee to cell "Client"

set theEmail to cell "Email"

set Alarm_flag to cell "Alarm_flag" as integer

set Alarm_interval to cell "Alarm_interval" as integer

set calTitle to cell "CalendarName"

end tell

end tell

set DateStart to date dateStartTxt

set DateEnd to date dateEndTxt

tell application "iCal"

set theCalendar to 1st calendar whose title is calTitle

tell theCalendar

set theEvent to make new event at end of events

tell theEvent

set start date to DateStart

set end date to DateEnd

set summary to theSummary

set location to theLocation

set description to Desc

set allday event to false

if theAttendee is not "" then

try

make new attendee at beginning of attendees with properties {display name:theAttendee, email:theEmail}

end try

end if

if Alarm_flag = 1 then

make new display alarm at end of display alarms of theEvent with properties {trigger interval:Alarm_interval}

end if

--set recurrence to "FREQ=DAILY;INTERVAL=2;UNTIL=20040531T035959Z"

end tell

end tell

end tell

  • Like 1
Link to comment
Share on other sites

I would love for that plug-in to be fully functional. However, it appears that it currently cannot add "attendees", which I consider pretty important to synchronize with a FileMaker solution, since it's where you'd want to put your people and their email address. From their manual:

NOTE: For the moment attendees could only be added by iCal (maybe Apple Inc. is changing that in the future).

I can't test it as I don't have Leopard yet.

Link to comment
Share on other sites

To see the syntax for a typical iCal event choose 'File > Export...' within iCal. Open the resulitng .ics file within a text editor. If you double click the resulting file it will automatically be imported back into iCal.

Stripped to its bare essentials you'll find that an iCal event is simply a text file with the following elements:

BEGIN:VCALENDAR

BEGIN:VEVENT

DTSTART;TZID=US/Pacific:20071111T100000

DTEND;VALUE=DATE:20071111

SUMMARY:event title

DESCRIPTION:notes

BEGIN:VALARM

ACTION:AUDIO

TRIGGER:-PT7M

ATTACH;VALUE=URI:Basso

END:VALARM

END:VEVENT

END:VCALENDAR

Attached is a file with a script that exports Filemaker data to iCal. It places an iCal event on the desktop and then imports it into iCal using AppleScript.

An alternative approach is necessary if your users are on a PC and/or wish to export Filemaker data to a .vcal file.

iCalExport.fp7.zip

  • Like 1
Link to comment
Share on other sites

  • 2 years later...

Thanks, mfero, for that file. However, when I use it I have some odd behavior. My iCal icon jumps in the dock, so I switch to iCal, but nothing happens. I have to toggle to another app, such as the Finder or FileMaker; I do this for 1 or 2 times; then when I toggle back to iCal, I have a dialog asking me to choose a calendar for the new entry.

Is there a way to script all FileMaker exports to iCal to go to a particular calendar without prompting the user? Also, any idea why I need to toggle off of iCal a few times before I see the iCal dialog box?

Thanks.

Link to comment
Share on other sites

  • 3 months later...
  • Newbies

Yes Easy.

I do a bit of system checking to verify the user is on a mac blah blah then here is the applescript.

Also setting the time as a variable first then changing the year month then day in that order is the safe way in case another users system clock settings are goofy.

"set DateVar to current date¶set the year of DateVar to " & Year ( Art Schedule::Art Deadline ) & "¶set the month of DateVar to " & Month ( Art Schedule::Art Deadline ) & "¶set the day of DateVar to " & Day ( Art Schedule::Art Deadline ) & "¶try¶tell application "iCal"¶tell calendar "Robb's Calendar"¶set newEvent to make new event at end with properties {description:"" & Art Schedule::Sales Order Information & " Ship Date: " & Art Schedule::Scheduled Ship Date & "",summary:"Work Order #" & Art Schedule::Work Order # & " " & Art Schedule::Company & "",start date:DateVar,end date:DateVar + " & Art Schedule::Budgeted Hrs & " * hours}¶make new sound alarm at end of newEvent with properties {trigger interval:-30}¶show newEvent¶end tell¶end tell¶on error¶display dialog "There was an error" buttons {"OK"}¶end try"

You could copy and paste that directly into filemaker as it is a calculated script. then just change my fields to your fields. Might need to get ride of some false returns or spaces once pasted not sure. Here is how an applescript would look not in filemaker.

set DateVar to current date

set the year of DateVar to 2010

set the month of DateVar to 6

set the day of DateVar to 21

try

tell application "iCal"

tell calendar "Some Calendar"

set newEvent to make new event at end with properties {description:"This is the notes area",summary:"This is the title",start date:DateVar,end date:DateVar + 1 * hours}

make new sound alarm at end of newEvent with properties {trigger interval:-30}

show newEvent

end tell

end tell

on error

display dialog "There was an error." buttons {"OK"}

end try

now the show event step take you to that event to edit it. so If you didn't want iCal to come to focus simply don't use that part.

Let me know if that helps?

Edited by Guest
Link to comment
Share on other sites

  • 4 months later...
  • 4 years later...

Mike is correct! Our Zulu product syncs with Google Calendars and also acts as a CalDAV server, so you can see calendars in Apple Calendar or any other CalDAV client. It also is supported in OS X 10.6+/Windows 2008 R2+/Windows Vista+ and FMS 11+. 

Link to comment
Share on other sites

This topic is 3409 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

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