gpt4 book ai didi

compiler-errors - Applescript - 预期行尾但找到标识符

转载 作者:行者123 更新时间:2023-12-02 10:43:45 25 4
gpt4 key购买 nike

我一直在用 Applescript 为我的一个 friend 制作一些东西,通常,通过一些搜索/研究,我能够克服我一直面临的问题。但是...我发现了一个我不理解的问题。

例如,我有:

tell application "Acrobat Distiller"
Distill sourcePath inputFile1 adobePDFSettingsPath fullPathToJobOptions
end tell

如果我将它替换为:

tell application "/Applications/Adobe Acrobat XI Pro/Acrobat Distiller.app"
Distill sourcePath inputFile1 adobePDFSettingsPath fullPathToJobOptions
end tell

我没有任何问题...但是...如果我做类似的事情:

set thePathToDistiller to "/Applications/Adobe Acrobat XI Pro/Acrobat Distiller.app"

tell application thePathToDistiller
Distill sourcePath inputFile1 adobePDFSettingsPath fullPathToJobOptions
end tell

我在“Distill sourcePath inputFile1 adobePDFSettingsPath fullPathToJobOptions”行中收到错误。更准确地说是“sourcePath”这个词。错误是:“语法错误:预期行尾但找到标识符”

这里可能有什么问题?(感谢您提供的任何帮助!):)

最佳答案

tell application "Acrobat Distiller"

编译器可以看到程序的名称,并在编译时载入程序的字典。有了字典,它就知道 Distill 的含义及其参数。

同理

tell application "/Applications/Adobe Acrobat XI Pro/Acrobat Distiller.app"

程序的名称(实际上是路径)就在引号中,编译器可以查看应用程序以提取其字典。

tell application thePathToDistiller

编译器不知道您正在与哪个程序交互。脚本仅在运行时知道存储在 thePathToDistiller 中的值,而让编译器知道要查找哪个应用的字典已经太晚了。

关于compiler-errors - Applescript - 预期行尾但找到标识符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27663893/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com