【问题标题】:How to pass data from a FileMaker field to an Applescript如何将数据从 FileMaker 字段传递到 Applescript
【发布时间】:2013-09-11 02:00:34
【问题描述】:

我需要从 FileMaker 中删除我的 Cincinnati Laser 上的一个文件。它通过 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

我错过了什么?

【问题讨论】:

  • 你能在第二个脚本中记录 xpath 的值吗?试试这个作为第二行(不带引号):'display dialog (xpath as string)'。我的预感是这与将 xpath 值正确地放入 Applescript 中有关。

标签: applescript filemaker


【解决方案1】:

使用计算执行 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

【讨论】:

    【解决方案2】:

    每当我需要将信息从 FileMaker 传递到 AppleScript 时(我承认,我已经有一段时间没有这样做了),我使用了执行 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-10
      • 2014-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多