【发布时间】:2017-07-10 13:55:47
【问题描述】:
我正在尝试编写一个“简单”的小程序,它将在 InDesign 中找到一个具有特定属性的文本框架,然后更改该特定文本框架的段落样式。我知道 if 语句是正确的,因为我将它用于其他 applescript。 所以我有一个名为“PriceBox”的对象样式的文本框架。如果文本框架中包含斜杠“/”,我想将段落样式更改为“2for”。我确认文档中存在段落样式。但是,当我运行脚本时,我得到了这个错误:
错误“无法将 {«class txtf» id 6905 of «class sprd» id 6891 of document id 4 of application \"Adobe InDesign CC 2015\"} 设置为 \"2for\" 的 «class psty»。 "编号 -10006 从 {«class txtf» 的 «class psty» id 6905 of «class sprd» id 6891 of document id 4} 到 «class 2for»
我尝试了“设置段落样式”脚本的变体,但它们似乎都不起作用。请帮忙! =) 谢谢!
告诉应用程序“Adobe InDesign CC 2015”
tell active document
set horizontal measurement units of view preferences to inches
set vertical measurement units of view preferences to inches
repeat with x from 1 to count pages
set ThisPage to page x
tell ThisPage
if exists (text frames whose (name of applied object style is "PriceBox" and contents contains "/$")) then
set paragraph style of (get text frames whose name of applied object style is "PriceBox") to "2for"
end if
end tell
end repeat
end tell
说完
【问题讨论】:
标签: applescript adobe stylesheet adobe-indesign