如何将数据从FileMaker字段传递到Applescript

时间:2013-09-11 02:00:35

标签: applescript filemaker

我需要从FileMaker中删除Cincinnati Laser的文件。它通过FMScript将其导出到那里,该FMScript将容器的字段内容导出到此位置。所以我知道文件名和它所有内置在该记录的计算字段中的路径。但我不知道如何使用FM12“执行AppleScript”脚本步骤将该信息转换为Applescript 当我硬编码路径和文件名(如下所示)时,它可以工作。

set xpath to "Titanium Brain:Users:smartin:Desktop:Laser:1512-clr-c.cnc"
tell application "Finder"
   delete file xpath
end tell

当我尝试传递字段内容(如下所示)时,它不起作用。

set xpath to Laser::gCNCPath
tell application "Finder"
   delete file xpath
end tell

我错过了什么?

2 个答案:

答案 0 :(得分:2)

使用计算执行AppleScript的问题始终是报价和退货的管理。将以下内容完全放入“执行Applescript”脚本步骤的“计算的Applescript”框中应该对您有用:

"set xpath to " & Quote ( Laser::gCNCPath ) & ¶ &
"tell application \"Finder\"¶" &
   "delete file xpath¶" &
"end tell"
然而,老实说,整件事情很快变得非常丑陋。如果您已正确锁定安全性,我会更倾向于将整个脚本放入Laser :: gCNCPath字段

set xpath to "Titanium Brain:Users:smartin:Desktop:Laser:1512-clr-c.cnc"
tell application "Finder"
    delete file xpath
end tell

然后,对于Perform Applescript,您只需要调用该字段:

Laser::gCNCPath

答案 1 :(得分:0)

每当我需要将信息从FileMaker传递给AppleScript时(我承认,我已经有一段时间了),我在Perform AppleScript对话框中使用了Native AppleScript字段并使用了一个全局字段,用于存储AppleScript需要的“参数”,并使用AppleScript提取该信息。

set xpath to cell "gCNCPath" of layout "Laser" of current file -- double check this syntax, I'm working from memory
tell app "Finder" to delete file xpath