这是我运行脚本时收到的错误/消息
item1 of {title:"& $Title &",startDate:"& $StartDate &"....} cannot be requested. Unknown error: -1728
我的 FMscriptParams 列表似乎无法与 Applescript 通信。
有人有办法让脚本正常工作吗? 我未来的目标是让Calendar(MacOS)和FilemakerRecord同步。如果我更新记录,让它更改 CalendarEvent,如果我更改 CalendarEvent,让它更改记录。
这是我正在使用的 Filemaker 脚本
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 ]
这是我正在使用的原生AppleScript
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 ]
您无法在本机 AppleScript 中使用 FileMaker 变量和计算。使用 AppleScript 获取字段值或选择
Calculated AppleScript
选项并在其中构造 AppleScript 的文本。
(您可能会遇到将 FileMaker 的日期转换为 AppleScript 的日期的问题。如果这样做,请就此提出一个单独的问题。)