我试过这段代码:
tell application "Adobe InDesign CS6"
set ParaIdOrSecId to "ti0005"
set xpa to "//*[@*='" & ParaIdOrSecId & "']" as string
tell active document
tell XML element 1
set Requriedxpa to evaluate XPath expression using xpa
end tell
end tell
end tell
执行后,InDesign会显示一个对话框:
内容包含无法编码的字符。
为什么我无法执行它,即使它是一个有效的xpath?
答案 0 :(得分:1)
此问题不仅限于XPath,我从其他XML功能(如导出)中了解到这一点。导致对话框的一个典型字符是右对齐选项卡(作为shift-tab输入)。使用导出有助于仅禁用对话框,因为对话框直接连接到内部XML流并且不会产生错误/异常:
set user interaction level of script preferences to never interact