Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

Hi! I know absolutely nothing about AppleScript, and in fact only started using FileMaker a short while ago. I thought, like most other things, I would be able to find engouh examples or at least a reference on applescripting to be able to write a script, but I was wrong. Really, really wrong. Because I can't find anything close to what I want to do, which is shocking. Anyway, on to the task at hand:

I need to be able to click a button in my database that will say "Add event to iCal" and actually have that event added to iCal. That's it. Nothing fancy. But anything I've tried has been a stab in the dark and has produced either no results, or error messages. Does anybody have any good resources on this stuff, or know of anything at all that could help me?

I will be forever grateful to all who help. THANKS!!!!!!!

Amber

Posted

Yes, it is sad that there are few good resources. It is partly because FileMaker is cross-platform, hence AppleScript is limited to Macs (duh). But it is also because Apple has not been 100% behind AppleScript in its own applications. For example, I spent days working out synchronization between FileMaker and iCal, only to find a flaw in iCal's dictionary. Which is that you cannot get or set the note of a To Do (events are fine however). I decided to wait until they get serious. In any case, here's an AppleScript to create an event.

You must have the fields specified (or change them) on the current record on the current layout. That's easiest.

Uncomment the --tell application "FileMaker Developer" and its --end tell lines to open the below in Script Editor. But they are not needed inside a FileMaker Perform AppleScript step. It's best to write AppleScripts in Script Editor, for its syntax coloring and error checking, then copy/paste into a FileMaker Perform AppleScript step, and comment the appropriate lines.

I've commented the location line, as I wasn't using it. You could.

--tell application "FileMaker Developer"

tell current record of window 1

set dateStartTxt to cell "TimeStampStart"

set dateEndTxt to cell "TimeStampEnd"

set theSummary to cell "EventName"

set theCalendar to cell "CalendarName"

end tell

--end tell

set DateStart to date dateStartTxt

set DateEnd to date dateEndTxt

tell application "iCal"

tell calendar "your calendar name"

set new_event to make new event at end of events

tell new_event

set start date to DateStart

set end date to DateEnd

set summary to theSummary

--set location to "some location"

set allday event to false

set status to confirmed

end tell

end tell

end tell

Posted

You've just made me (and my boss and the events planning people) extremely happy. Thank you so much! Honestly, I will bake and ship you cookies if you want. :]

Amber

Posted

You're welcome. Unfortunately, re: cookies, I'm afraid I'm kind of on a diet. Too much sitting around at the computer :-]

Here's another little tidbit, which I gathered from someone else. You can create an alarm for an event via AppleScript also.

-- No. alarms are not properties, they're elements. You have to make them after the event exists:

set StartDate to "11/24/2003 9:00 AM"

set enddate to "11/24/2003 10:00 AM"

set alarmTrigger to "-15"

set soundName to "Sosumi"

tell application "iCal"

set newEvent to make new event at end of calendar 3 with properties {summary:"hello", start date:StartDate, end date:enddate}

tell newEvent

make new sound alarm at end of sound alarms with properties {trigger interval:alarmTrigger, sound name:soundName}

end tell

end tell

You would have to do what he's done, to create a variable to reference the event. Just put...

set newEvent to make new event

...when you create the event. newEvent is then a variable which can be used to address that event for the alarm.

This topic is 7070 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.