Article View: adobe.scripting.indesign
Article #819Re: script request
From: Jeremy_Bowman
Date: Wed, 04 Mar 2009 19:31
Date: Wed, 04 Mar 2009 19:31
33 lines
2104 bytes
2104 bytes
This version expects you to manually select a bunch of graphic boxes and 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 != 0){
myList = app.selection;
for (var i = 0; i < myList.length; i++){
var myBox = app.selection[i];
if (myBox.constructor.name == "TextFrame" || myBox.constructor.name == "Rectangle"){
myExpand(myBox);
}
else
alert("The script stopped running because a non-recrangle was selected.");
}
}
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.4@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.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!news2.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: script request Message-ID: <59b81d1a.4@webcrossing.la2eafNXanI> Date: Wed, 4 Mar 2009 11:31:36 -0800 References: <59b81d1a.-1@webcrossing.la2eafNXanI> Lines: 42 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit