🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #10139

Re: [VB] Fitting of Multicolumn TextFrame

#10139
From: harbs
Date: Thu, 06 Jul 2006 18:14
40 lines
2353 bytes
Here's what I use.

userHoriz = app.documents[0].viewPreferences.horizontalMeasurementUnits;
userVert = app.documents[0].viewPreferences.verticalMeasurementUnits;
app.documents[0].viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
app.documents[0].viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
myDoc = app.activeDocument;
myFrame = app.selection[0];
myIndx = myFrame.characters[-1].index;
myColumns = myFrame.textFramePreferences.textColumnCount;
userZP = myDoc.zeroPoint;
myDoc.zeroPoint = [myFrame.geometricBounds[1],myFrame.geometricBounds[0]];
myJust = myFrame.textFramePreferences.verticalJustification;
myBounds = myFrame.geometricBounds;
origHeight = myBounds[2] - myBounds[0];
myFrame.textFramePreferences.verticalJustification = VerticalJustification.topAlign;
myLength = 0;
for (var j=0; myFrame.textColumns.length > j; j++) {
 myLength = myLength + myFrame.textColumns[j].lines[-1].baseline;
}

myNewBot = (myLength)/(myColumns) + 8;
 myBounds[2] = myNewBot
 myFrame.geometricBounds = myBounds;

while (myFrame.characters[-1].index == myIndx) {
  myBounds = myFrame.geometricBounds;
  myBounds[2] = myBounds[2] - 3;
  myFrame.geometricBounds = myBounds;
 }
 while (myFrame.characters[-1].index < myIndx) { myBounds = myFrame.geometricBounds;  myBounds[2] = myBounds[2] + 1; myFrame.geometricBounds = myBounds; }

myFrame.textFramePreferences.verticalJustification = myJust;
 app.documents[0].viewPreferences.horizontalMeasurementUnits = userHoriz
 app.documents[0].viewPreferences.verticalMeasurementUnits = userVert
myDoc.zeroPoint = [0,0];
myDoc.zeroPoint = userZP;


Harbs
Technical Details
Message-ID: <3bbfb539.4@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!newspeer1.de.telia.net!newspeer4.de.telia.net!de.telia.net!newsfeed.freenet.de!news.albasani.net!news.ecp.fr!news.stben.net!webcrossing
References: <3bbfb539.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,27b3014da76ecb9f
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: harbs@adobeforums.com
Newsgroups: adobe.scripting.indesign
Subject: Re: [VB] Fitting of Multicolumn TextFrame
Message-ID: <3bbfb539.4@webcrossing.la2eafNXanI>
Date: Thu, 6 Jul 2006 11:14:18 -0700
References: <3bbfb539.-1@webcrossing.la2eafNXanI>
Lines: 50
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news2.volia.net!newspeer1.de.telia.net!newspeer4.de.telia.net!de.telia.net!newsfeed.freenet.de!news.albasani.net!news.ecp.fr!news.stben.net!webcrossing