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

graphic line

Explorer ,
May 04, 2023 May 04, 2023

Copy link to clipboard

Copied

Dear all,

   How to draw a graphic line above a specific text frame in Adobe InDesign using scripting

 

Thanks in advance

TOPICS
Scripting , SDK

Views

623

Translate

Translate

Report

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

Community Expert , May 04, 2023 May 04, 2023

Hi @John_devs , Select a text frame and try this:

 

 

app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
var tf = app.documents[0].selection[0];
var b = tf.geometricBounds;
var p = tf.parentPage;
var g = 5;//gap above frame in points
p.graphicLines.add({geometricBounds: [b[0]-g, b[1], b[0]-g, b[3]], strokeColor:"Black", strokeWeight:1});

app.scriptPreferences.measurementUnit = AutoEnum.AUTO_VALUE;

 

 

Before:

Screen Shot.png

 

After:

Screen Shot 1.png

Votes

Translate

Translate
Community Beginner ,
May 04, 2023 May 04, 2023

Copy link to clipboard

Copied

Hi John_devs!
I think you need to explain the user case a little more in detail so we can give you a hand.

Votes

Translate

Translate

Report

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
Community Expert ,
May 04, 2023 May 04, 2023

Copy link to clipboard

Copied

Hi @John_devs , Select a text frame and try this:

 

 

app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
var tf = app.documents[0].selection[0];
var b = tf.geometricBounds;
var p = tf.parentPage;
var g = 5;//gap above frame in points
p.graphicLines.add({geometricBounds: [b[0]-g, b[1], b[0]-g, b[3]], strokeColor:"Black", strokeWeight:1});

app.scriptPreferences.measurementUnit = AutoEnum.AUTO_VALUE;

 

 

Before:

Screen Shot.png

 

After:

Screen Shot 1.png

Votes

Translate

Translate

Report

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
Explorer ,
May 04, 2023 May 04, 2023

Copy link to clipboard

Copied

Thanks a lot it helped so much.

i need one more assisstance:

i need to draw graphiclines to a particularaly one textframe in each page when i run the script 

Votes

Translate

Translate

Report

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
Community Expert ,
May 05, 2023 May 05, 2023

Copy link to clipboard

Copied

LATEST

How script should know which TextFrame? 

 

Votes

Translate

Translate

Report

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
Community Expert ,
May 04, 2023 May 04, 2023

Copy link to clipboard

Copied

Why do you want to script it, use paragraph styles. 

Votes

Translate

Translate

Report

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
People's Champ ,
May 04, 2023 May 04, 2023

Copy link to clipboard

Copied

or script those but indeed.

Votes

Translate

Translate

Report

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