Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Make sure text frames do not exceed margin

Engaged ,
Sep 19, 2016 Sep 19, 2016

I need a script which detects text frames which exceed a 10mm page margin.

I'd like these frames to automatically be set to the edge of the margin at 10mm.

var frames = app.activeDocument.textFrames.everyItem().getElements();

var marg = app.activeDocument.pages.everyItem().marginPreferences;
for (i=0;i<frames.length;i++){
if (frames.geometricBounds>marg){
    frames.geometricBounds=marg;
    }
}

Am I on the right track with this script?

TOPICS
Scripting
310
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Sep 20, 2016 Sep 20, 2016

Hi jakec88782761

geometricBound is an array itself. The entries in the array are (y1, x1, y2, x2). Yes the array starts with y not x, historical reasons.

Wo what you want to test is  … geometricBounds[1] …

kind regards

Daniel (from Switzerland)

Translate
Engaged ,
Sep 19, 2016 Sep 19, 2016

I really only need the left hand side of the frame to not exceed the left hand margin

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 20, 2016 Sep 20, 2016
LATEST

Hi jakec88782761

geometricBound is an array itself. The entries in the array are (y1, x1, y2, x2). Yes the array starts with y not x, historical reasons.

Wo what you want to test is  … geometricBounds[1] …

kind regards

Daniel (from Switzerland)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines