我正在尝试更新Pages Apple脚本以在Catalina上使用。在更新之前,此方法已经起作用,但是现在此行失败了:
set the targetExportFileHFSPath to "/Users/me/Desktop/tmp.pdf"
export thisDocument to file targetExportFileHFSPath as PDF <-- FAIL
知道为什么吗?
答案 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