使用 Applescript 在 Indesign 中删除样式时清除字符样式覆盖
Clearing character style overrides when deleting styles in Indesign using Applescript
我正在将 400 多个文档转换为新的布局格式。
我正在尝试删除字符样式并移除其格式。 (AKA, delete a character style with the checkbox checked).
这是我的代码:
delete character style "Exhibit Number" of character style group "Exhibit Styles"
replacing with character style "[None]"
删除字符样式有效,但不删除格式。在黑暗中随机插入,例如附加 无格式 、 无保留格式 、 无覆盖 和 with "Preserve Formatting" = false 触发错误。
有没有办法通过脚本来做到这一点? (我可以 with properties{None},通过设置不保留覆盖的首选项,或者其中的一些变化吗?)
"[None]" 不是每个人所说的字符样式。它更像是 link 风格破坏者。因此,不会删除任何覆盖。一种解决方案是基于 [None] 创建虚拟 "None" 字符样式,然后最终转向 [None] 字符样式。
在 JavaScript 中将是:
//Removing overrides
text.clearOverrides();
//Setting to dummy None
text.appliedCharacterStyle = app.activeDocument.characterStyles.item("My Dummy Sans");
//Now breaking link to a character style i.e. applying "[None]";
text.appliedCharacterStyle = app.activeDocument.characterStyles[0];
正如 Loic 指出的那样,问题源于期望 [None] 表现得像正常风格。
以下 Applescript 解决了这个问题:
try
set charstyle to make character style with properties {name:"TempCharStyle"}
delete character style "Exhibit Number" of character style group "Exhibit Styles" replacing with character style "TempCharStyle"
delete character style "TempCharStyle"
end try
我正在将 400 多个文档转换为新的布局格式。
我正在尝试删除字符样式并移除其格式。 (AKA, delete a character style with the checkbox checked).
这是我的代码:
delete character style "Exhibit Number" of character style group "Exhibit Styles"
replacing with character style "[None]"
删除字符样式有效,但不删除格式。在黑暗中随机插入,例如附加 无格式 、 无保留格式 、 无覆盖 和 with "Preserve Formatting" = false 触发错误。
有没有办法通过脚本来做到这一点? (我可以 with properties{None},通过设置不保留覆盖的首选项,或者其中的一些变化吗?)
"[None]" 不是每个人所说的字符样式。它更像是 link 风格破坏者。因此,不会删除任何覆盖。一种解决方案是基于 [None] 创建虚拟 "None" 字符样式,然后最终转向 [None] 字符样式。
在 JavaScript 中将是:
//Removing overrides
text.clearOverrides();
//Setting to dummy None
text.appliedCharacterStyle = app.activeDocument.characterStyles.item("My Dummy Sans");
//Now breaking link to a character style i.e. applying "[None]";
text.appliedCharacterStyle = app.activeDocument.characterStyles[0];
正如 Loic 指出的那样,问题源于期望 [None] 表现得像正常风格。
以下 Applescript 解决了这个问题:
try
set charstyle to make character style with properties {name:"TempCharStyle"}
delete character style "Exhibit Number" of character style group "Exhibit Styles" replacing with character style "TempCharStyle"
delete character style "TempCharStyle"
end try