有没有办法在InDesign中提出一个javascript,在通过XML将图像导入InDesign后,我可以运行一个脚本,将特定的对象样式映射到特定的标签?就像Tag允许的段落样式和字符样式一样。不知道为什么Adobe不允许对象样式以相同的方式工作。
答案 0 :(得分:0)
答案 1 :(得分:0)
我找到的答案如下......
/**
IMAGE OBJECT STYLE SCRIPT
*/
var actions = [
/*
-------------------------
| ACTION:Default Action |
-------------------------
*/
function DefaultAction(){
/** command array */
var commands = [
/** ACTION FUNCTIONS BEGIN HERE: **/
/* Assign a property from the objectStyles collection */
function assign_appliedObjectStyle(obj){
obj.appliedObjectStyle = document.objectStyles.itemByName("Image");
}
];
/** START ACTION EXECUTION CODE: **/
var applyToSelection = [true,true,true,true];
var repeats = 1;
while(repeats--){
for(var idx=0; idx < commands.length; idx++){
try{var i = void 0; (!applyToSelection[idx])?commands[idx]():(function(command){
while((i = (i||0)+1) <= app.selection.length){
try{ command(app.selection[i-1]); }catch(err){
//Selection command error handling code here.
}
}})(commands[idx]);}catch(err){
//Insert Error Handling Code Here.
}}}
/** END ACTION EXECUTION CODE: **/
}
];
for(var idx = 0; idx < actions.length; idx++){
actions[idx]()
}