0
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?

InDesignフレーム調整オプションを全ページから一括消去

Last updated at Posted at 2025-03-09

InDesignで画像差し替えの際に問題になるのが、画像フレームの自動調整オプションです。
レイアウトを試行錯誤しているときは便利なのですが、これがオンだと画像をリサイズしてUSMして…という正規の手順で差し替えるとトリミングが吹っ飛びます。なので差し替える前に消去しておきたい。
SS_InDesign_20250309-185020.png

実行すると、全ページ全リンクフレームから「フレーム調整オプションを消去」します。

フレーム調整オプションを消去

var doc = app.activeDocument;
var graphics = doc.allGraphics;
var counts = {};

if (!confirm("リンク画像フレームの自動調整をオフにしますか?")) {
  exit();
}

for (var i = 0, len = graphics.length; i < len; i++) {
  var frame = graphics[i].parent;
  if (frame instanceof Rectangle || frame instanceof Oval || frame instanceof Polygon) {
    if (frame.frameFittingOptions.autoFit && frame.parentPage !== null && frame.visible && frame.itemLayer.visible) {
      frame.frameFittingOptions.autoFit = false;

      var pageNum = frame.parentPage.name;
      counts[pageNum] = (counts[pageNum] || 0) + 1;
    }
  }
}

var message = "";
for (var pageNum in counts) {
  message += pageNum + "ページ(" + counts[pageNum] + "アイテム)\n";
}

alert(
  message
    ? "処理したアイテムと含まれるページ\n\n" + message
    : "処理したアイテムはありませんでした。"
);

0
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
0
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?