Created
May 25, 2010 00:53
-
-
Save kanemu/412620 to your computer and use it in GitHub Desktop.
[indesign][extendscript]テキストフレームを連結する。
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
(function(){ | |
var sels=app.activeDocument.selection; | |
var startFrame; | |
//テキストフレーム以外を除外 | |
for(var i=sels.length-1;i>-1;i--){ | |
if(sels[i].constructor.name!=='TextFrame'){ | |
sels.splice(i,1); | |
}else{ | |
sels[i].nextTextFrame=NothingEnum.NOTHING; | |
} | |
} | |
//0なら抜ける | |
if(sels.length==0) return; | |
//ソート用のfuncを返す | |
var ortn=sels[0].parentStory.storyPreferences.storyOrientation; | |
var x=(ortn==1752134266)? 0:3; | |
var func=(function(x){ | |
return (function(a,b){ | |
if(x===0){var a_=a,b_=b}else{var a_=b,b_=a}; | |
return a_.geometricBounds[x]-b_.geometricBounds[x]; | |
}) | |
})(x); | |
//ソートする | |
sels.sort(func); | |
//フレームを連結する | |
var sel=sels.shift(); | |
while(sels.length>0){ | |
sel.nextTextFrame=sels.shift(); | |
sel=sel.nextTextFrame; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment