Help us understand the problem. What is going on with this article?

デザイン自動化メモ(InDesignオブジェクトの不透明度を変更する)

More than 1 year has passed since last update.

オブジェクトの不透明度を変更する。

アクティブドキュメントの全てのオブジェクトに対して不透明度を設定します。
オブジェクトpageItemの不透明度を変更するには、transparencySettings.blendingSettings.opacityを変更します(0ー100)。

pageItem.transparencySettings.blendingSettings.opacity = 50;

サンプル

下記の例では、スクリプトラベルに「hoge」が設定されていないオブジェクトに対して不透明度を設定します。

function setAppearance_Opacity(pageItem,opacity) {

    pageItem.transparencySettings.blendingSettings.opacity = opacity;
}

function doMain() {

    pageObj = app.activeDocument.pages[0];
    total = pageObj.allPageItems.length;

    var i = 0;

    for (i=0;i<total;i++) {
       var label = "";
       var typeName = "";
       var pageItem;

       pageItem = pageObj.allPageItems[i];

       var typeName = pageItem.constructor.name;
       label = pageItem.label; 

        // 特定のテキストフレームは処理をしない。ここではスクリプトラベルで判断する。
        if (label=="hoge") {

            continue;
        } 

       // オブジェクトの不透明度を変更する(アピアランス設定)
       if (typeName=="TextFrame") {

            setAppearance_Opacity(pageItem,50);
       }
    }
}

function main() {

      app.doScript("doMain()",ScriptLanguage.JAVASCRIPT,[],UndoModes.fastEntireScript);
 }

main();

実行結果

実行前
スクリーンショット 2018-07-29 23.45.32.png

実行後
スクリーンショット 2018-07-29 23.45.49.png

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away