This is the Error/Message I get back when running the Script
item1 of {title:"& $Title &",startDate:"& $StartDate &"....} cannot be requested. Unknown error: -1728
It seems the problem that my list of FMscriptParams Does not communicate with the Applescript.
Does anyone have a solution to get the script working. My future goal is to let Calendar(MacOS) and FilemakerRecord synchronize. If I update the record, let it change the CalendarEvent and if I change the CalendarEvent, let it change the record.
This is the Filemaker Script I'm using
Set variable [ $Title; Value:"Customer" & Log::X & Customers::CustomerID letters ]
Set variable [ $StartDate; Value:Log::Date of project start duration ]
Set variable [ $EndDate; Value:Log::Project end date or end of duration ]
Set variable [ $Location; Value:Log::Location ]
Set variable [ $Description; Value:Log::Description ]
This is the Native AppleScript I'm using
Run AppleScript [ Native AppleScript:
-- Get FileMaker script parameters
set fmScriptParams to {title: "& $Title &", startDate: "& $StartDate &", endDate: "& $EndDate &"}
tell application "FileMaker Pro Advanced" set scriptParams to fmScriptParams
-- Get the list of FileMaker repeat script parameters with i from 1 to count of scriptParams
set end of fmScriptParams to item i of scriptParams end repeat end tell
-- Assign the script parameters to AppleScript variables
set eventTitle to item 1 of fmScriptParams
set startDate to item 2 of fmScriptParams
set endDate to item 3 of fmScriptParams
set eventLocation to item 4 of fmScriptParams
set eventDescription to item 5 of fmScriptParams
-- Then perform actions with the assigned variables
-- For example, here you can display the values of the variables display dialog "Event Title: "& eventTitle & return & ¬ "Start Date: "& startDate & return & ¬ "End Date: "& endDate & return & ¬ "Location: "& eventLocation & return & ¬ "Description: "& eventDescription
-- Find the iCloud calendar by name
set iCloudCalendarName to "FM"
-- The name of your iCloud calendar
-- Add the appointment to the iCloud calendar
tell application "Calendar" set iCloudCalendar to calendar iCloudCalendarName
set newEvent to make new event at iCloudCalendar with properties ¬ {summary:eventTitle, start date:startDate, end date:endDate, location:eventLocation, description:eventDescription} tell newEvent
-- You can set additional properties if necessary, such as notifications, participants, etc.
end tell activate
end tell ]
You cannot use FileMaker variables and calculations inside native AppleScript. Either get the field values using AppleScript or choose the
Calculated AppleScriptoption and construct the AppleScript's text there.(You will probably run into a problem of converting FileMaker's date to AppleScript's date. If you do, ask a separate question about that.)