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

graphic line

Explorer ,
May 04, 2023 May 04, 2023

Dear all,

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

 

Thanks in advance

TOPICS
Scripting , SDK
956
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

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

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

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

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

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

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 

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
LEGEND ,
May 05, 2023 May 05, 2023
LATEST

How script should know which TextFrame? 

 

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

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

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

or script those but indeed.

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