Updating to MacOs Catalina make Apple script unable to export Pages Document: "Pages got an error: Invalid key form."

Updating to MacOs Catalina make Apple script unable to export Pages Document: "Pages got an error: Invalid key form."

我正在尝试更新 Pages Apple Script 以在 Catalina 上运行。这在更新之前是有效的,但现在这一行失败了:

set the targetExportFileHFSPath to "/Users/me/Desktop/tmp.pdf"
export thisDocument to file targetExportFileHFSPath as PDF <-- FAIL

知道为什么吗?

老实说,我很惊讶以前能奏效。 file 说明符很少(如果有的话)限定 posix 路径(这是您所拥有的,而不是变量名称所暗示的 HFS 路径)。

您可以尝试以下几种变体:

set filepath to POSIX file "/Users/me/Desktop/tmp.pdf"
-- set filepath to POSIX file "/Users/me/Desktop/tmp.pdf" as alias
-- set filepath to "/Users/me/Desktop/tmp.pdf" as «class furl»
-- set filepath to "/Users/me/Desktop/tmp.pdf" as «class fsrf»

然后 export 命令在每种情况下都只是:

export thisDocument to the filepath as PDF