在 InDesign 2020 中从 AppleScript 执行 ExtendScript
Executing ExtendScript from AppleScript in InDesign 2020
我正在尝试使用 do script
命令通过 AppleScript 打开并执行 JSX 脚本,如 Adobe InDesign Scripting Guide on this page 和互联网上其他地方所述:
The do script
method gives a script a way to execute another script. The script can be a string of valid scripting code or a file on disk.
script.scpt:
tell application "Adobe InDesign 2020"
activate
set jsx_script to "Macintosh HD:Users:xxx:project:script.jsx"
set val_1 to "Foo"
set val_2 to "Bar"
set my_values to {val_1, val_2}
do script jsx_script language javascript with arguments my_values
end tell
script.jsx:
#target "InDesign"
testFunc(arguments);
function testFunc(t) {
alert('argument one: ' + t[0] + '\r' + 'argument two: ' + t[1]);
}
但是没有用。我收到 "Expected end of line, etc. but found “script”." 语法错误。这是否意味着不再支持 do script
?我的环境是 macOS 10.15.3 和 InDesign 2020 (15.0.2)。感谢您的指点。
问题已通过更新到 macOS 10.15.4 自行解决。
我正在尝试使用 do script
命令通过 AppleScript 打开并执行 JSX 脚本,如 Adobe InDesign Scripting Guide on this page 和互联网上其他地方所述:
The
do script
method gives a script a way to execute another script. The script can be a string of valid scripting code or a file on disk.
script.scpt:
tell application "Adobe InDesign 2020"
activate
set jsx_script to "Macintosh HD:Users:xxx:project:script.jsx"
set val_1 to "Foo"
set val_2 to "Bar"
set my_values to {val_1, val_2}
do script jsx_script language javascript with arguments my_values
end tell
script.jsx:
#target "InDesign"
testFunc(arguments);
function testFunc(t) {
alert('argument one: ' + t[0] + '\r' + 'argument two: ' + t[1]);
}
但是没有用。我收到 "Expected end of line, etc. but found “script”." 语法错误。这是否意味着不再支持 do script
?我的环境是 macOS 10.15.3 和 InDesign 2020 (15.0.2)。感谢您的指点。
问题已通过更新到 macOS 10.15.4 自行解决。