Article View: adobe.scripting.indesign
Article #816Re: script request
From: Jeremy_Bowman
Date: Wed, 04 Mar 2009 18:33
Date: Wed, 04 Mar 2009 18:33
39 lines
2015 bytes
2015 bytes
Warning: I'm an amateur! But this seems to work for me. Select the box you want to expand, then run the script.
if (app.documents.length > 0){
var myDocument = app.activeDocument;
var myViewPreferences = myDocument.viewPreferences;
var myOldXUnits =
myViewPreferences.horizontalMeasurementUnits;
var myOldYUnits = myViewPreferences.verticalMeasurementUnits;
var myOldRulerOrigin = myViewPreferences.rulerOrigin;
myDocument.viewPreferences.horizontalMeasurementUnits
= MeasurementUnits.points;
myDocument.viewPreferences.verticalMeasurementUnits
= MeasurementUnits.points;
if (app.selection.length == 1){
var myBox = app.selection[0];
if (myBox.constructor.name ==
"TextFrame" || myBox.constructor.name == "Rectangle"){
myExpand(myBox);
}
else
alert("You
haven't selected a box as required. Select a box and try again.");
}
app.activeDocument.viewPreferences.horizontalMeasurementUnits
= myOldXUnits;
app.activeDocument.viewPreferences.verticalMeasurementUnits
= myOldYUnits;
app.activeDocument.viewPreferences.rulerOrigin
= myOldRulerOrigin;
}
function myExpand(myBox) {
var myBounds = myBox.geometricBounds;
myBox.geometricBounds = [myBounds[0] - 4.5,
myBounds[1] - 4.5, myBounds[2] + 4.5, myBounds[3]+4.5];
} //end function myExpand
Technical Details
Message-ID:
<59b81d1a.1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossingReferences:
<59b81d1a.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,20b482460be056c2 X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Jeremy_Bowman@adobeforums.com Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: script request Message-ID: <59b81d1a.1@webcrossing.la2eafNXanI> Date: Wed, 4 Mar 2009 10:33:27 -0800 References: <59b81d1a.-1@webcrossing.la2eafNXanI> Lines: 43 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit