Created
March 28, 2013 09:43
-
-
Save nbqx/5262004 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#target InDesign-7.0 | |
#include "./underscore.js" | |
// underscore-minだとエラーでる | |
var doc = app.activeDocument; | |
var page = _.chain(doc.pages).first().value(); | |
var itms = page.pageItems; | |
var ichiban_hidarini_aruyatsu = _.chain(itms).sortBy(function(o){ | |
var g = o.geometricBounds; | |
return g[1] | |
}).first().value(); | |
var tpl = _.template("ラベル名: <%= label %> てやつがいちばん左側にある"); | |
alert(tpl({label: ichiban_hidarini_aruyatsu.label})); | |
// var mar = _.pick(page.marginPreferences,'top','left','bottom','right'); | |
var mar = _.object(['top','left'],[ichiban_hidarini_aruyatsu.geometricBounds[0],ichiban_hidarini_aruyatsu.geometricBounds[1]]); | |
var done = _.chain(itms).map(function(tf){ | |
var ob = tf.geometricBounds; | |
var o = _.object(['width','height'],[ob[3]-ob[1],ob[2]-ob[0]]); | |
tf.geometricBounds = [mar.top,mar.left,mar.top+o.height,mar.left+o.width]; | |
return tf | |
}).value(); // 操作したやつのarray | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment