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
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:
After:
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.
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:
After:
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
Copy link to clipboard
Copied
How script should know which TextFrame?
Copy link to clipboard
Copied
Why do you want to script it, use paragraph styles.
Copy link to clipboard
Copied
or script those but indeed.