2017-11-30 13 views
0

InDesignドキュメント内のアクティブなページ上のすべてのテキストフレームを見つけて、それらを配列に配置する必要があります - 1つまたは複数のテキストフレーム特定のスクリプトラベル。試しましたJavaScriptでInDesignのすべてのテキストフレームを見つける方法

myPage = app.properties.activeWindow && app.activeWindow.activePage, 
myTextFrames = myPage.textFrames.everyItem().getElements(); 

しかし、これではアンカーされたテキストフレームは表示されません。 - テーブルセル内。 - グループ内。本当にすべてのテキストフレームを取得するにはどうすればいいですか?

答えて

1

1行には含まれません。

あなたが myPage.allPageItemsから開始する必要があるかもしれ

- >配列を返し、

  1. arrayElement.constructor.name == "TextFrame"

または

ことによってそれをフィルタリングします
  • arrayElement.label
      を== "yourTargetLabel"

    Jarek

  • 2

    R

    //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");

    を...

    関連する問題