1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

indesign スクリプト 構造内の要素を選択(選択された属性から)

Last updated at Posted at 2021-04-30

選択された構造内の属性から要素を選択するスクリプトはこれで良いのかな・・・?

/*
 選択された構造内の属性から要素を選択
 更新 2021/05/18
*/

// アプリ指定
#target "indesign";

// スクリプト名
var scriptName = "構造内の要素を選択(選択された属性から)";

// 選択されているオブジェクト
var selectobjects = app.activeDocument.selection;

// すべての選択を解除
app.activeDocument.selection = null;

// 選択オブジェクトの数だけ繰り返す
for(var i = 0; i < selectobjects.length; i++){

    // 選択オブジェクトが属性の場合
    if(selectobjects[i].constructor.name == "XMLAttribute"){

        // 親(要素)を選択に追加
        selectobjects[i].parent.select(SelectionOptions.addTo);
    }
}

// 結果表示
alert("選択数 " + app.activeDocument.selection.length,scriptName);
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?