更新到MacOs Catalina后,Apple脚本无法导出Pages文档:“页面出现错误:无效的密钥形式。”

时间:2019-11-17 01:15:11

标签: macos applescript macos-catalina

我正在尝试更新Pages Apple脚本以在Catalina上使用。在更新之前,此方法已经起作用,但是现在此行失败了:

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

知道为什么吗?

enter image description here enter image description here

1 个答案:

答案 0 :(得分:1)

老实说,我很惊讶以前曾经奏效。 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