我需要在InDesign文档中找到活动页面上的所有文本框架并将它们放入一个数组中 - 以便抓取一个或多个带有特定脚本标签的文本框架。我试过了
myPage = app.properties.activeWindow && app.activeWindow.activePage,
myTextFrames = myPage.textFrames.everyItem().getElements();
但是这并没有带来那些-anchored的文本框架; - 在桌子上; - 在一个小组中。我怎样才能真正获得所有文本框架?
答案 0 :(得分:2)
不在一行。
您可能需要从头开始 myPage.allPageItems - >返回一个数组并按
过滤它或
亚雷克
答案 1 :(得分:2)
ř
//Array of every single pageItem in the document
var myItems = doc.allPageItems;
var n = myItems.length, tfs = [], nItem;
//Looping through page items to collect text frames
while ( n-- ) {
nItem = myItems[n];
(nItem instanceof TextFrame) && tfs.push ( nItem );
}
//result
alert( tfs.length + " textframes have been found" );
你也可以通过处理故事来反过来:
//Storing all stories in the document.
var stories = doc.stories.everyItem().getElements(), n = stories.length, nStory, tfs = [];
//looping through stories to collect text frames
while ( n-- ) {
nStory = stories[n];
tfs.concat ( nStory.textContainers );
}
//result
alert( tfs.length + " textframes have been found" );
由你决定...