InDesign用スクリプト雛形

いつのまにかイラストレーターネタばかりなので。
たまにはInDesignスクリプトと思い立つ。
いろいろ試す為の雛形をまず作ってみた。
とりあえずテーブルの罫線の太さを変えるスクリプト


#include 'c.js';
//
var D = {
'execute' : function(OBJ){
	c(OBJ).each(D.PAGE);
},
//ページに対する処理
'PAGE' : function(page){
	c(page.textFrames).each(D.TF);
},
//レイヤーに対する処理
'LAYER' : function(layer){
},
//テキストフレームに対する処理
'TF' : function(tf){
	c(tf.tables).each(D.TBL);
},
//テーブルに対する処理
'TBL' : function(table){
	c(table.rows).each(D.ROW);
	StrokeWeight(table.rows[0],{'top':1});
	StrokeWeight(table.rows[table.rows.length-1],{'bottom':1});
},
//テーブルの行に対する処理
'ROW' : function(row){
	c(row.cells).each(D.CELL);
	StrokeWeight(row,{'left':1,'right':1});
},
//テーブルのセルに対する処理
'CELL'  : function(cell){
	StrokeWeight(cell,{"left":0.15,'right':0.15,'top':0.35,'bottom':0.35});
	D.CONTENTS(cell.contents);	
},
//コンテンツに対する処理
'CONTENTS' : function(contents){
	//$.writeln(contents);
}
}

//線幅を変える
var StrokeWeight = function(OBJ,SW){
	for(var i in SW)typeof SW[i] == 'number' && OBJ[i+'EdgeStrokeWeight']  = SW[i];
}

//実行
D.execute(app.activeDocument.pages);

組版時間を半減する! InDesign自動処理実例集

組版時間を半減する! InDesign自動処理実例集