Copy link to clipboard
Copied
Hi Everyone,
Request:
I want to find "H1" style in top of frame only. It is two column book.
If "H1" style comes in both the columns 1 and 2.
Problem:
Document using span columns, so the script will find all the H1 style falls in first line of every column.
Trying script in ways:
var myDoc = app.activeDocument
app.activeDocument.viewPreferences.horizontalMeasurementUnits = app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;
var myTextFrame = myDoc.textFrames.everyItem().getElements()
for(i=0; i<myTextFrame.length; i++)
{
if(parseInt(myTextFrame.geometricBounds[3] - myTextFrame.geometricBounds[1]) == 180)
{
for(j=0; j<myTextFrame.textColumns.length; j++)
{
if(myTextFrame.textColumns
{
alert("H1 in First line of Frame\n"+ "Contents:" + myTextFrame.textColumns
app.select(myTextFrame.textColumns
exit(0)
}
}
}
}
Could anyone please give solution.
Kindly check the screenshot
Thanks in advance
Beginner_x
Copy link to clipboard
Copied
Hi,
A solution could be to compare .endBaseline properties.
i.e.:
myTextFrame.textColumns[0].lines[0].endBaseline ==> this could be a base for textFrame
so make the next if startement with two conditions:
- proper paraStyle
- proper endBaseline of 1st line of x textColumn (equal or "no higher then...")
rgds
Jarek