🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #8311

resize all pictures to page margin and apply Object Style

#8311
From: georgeharell
Date: Tue, 17 Oct 2006 13:15
49 lines
2080 bytes
Hy,

I have some problems with this scripting in Indesign.
I need to resize all pictures in a document to the page margins.
That works very well,

but now I would like to apply an ObjectStyle to the picture's frame. And all I got is, that the Object Style is applied to the picture directly and not to the frame.

I hope u know what I mean.

Does anybody know how I can manige it? Here is my script.

Thanks a lot, George

var myDoc = app.activeDocument;
for(var i=0; i<myDoc.allGraphics.length; i++)

{

//loop
var myGraphic = myDoc.allGraphics[i];	



//x and y
var myLeft = app.activeWindow.activePage.marginPreferences.right;
var myTop = app.activeWindow.activePage.marginPreferences.top;

//height and width of page
var myPageWidth = app.activeDocument.documentPreferences.pageWidth - (app.activeWindow.activePage.marginPreferences.left + app.activeWindow.activePage.marginPreferences.right);
var myPageHeight = app.activeDocument.documentPreferences.pageHeight - (app.activeWindow.activePage.marginPreferences.top + app.activeWindow.activePage.marginPreferences.bottom);

//size of the picture
var bildrand = myGraphic.visibleBounds;
var picture_x = bildrand[3] - bildrand[1]

//percent
var percent = 100*(myPageWidth/picture_x);

//resize
myGraphic.resize(percent, percent, AnchorPoint.topLeftAnchor, true, true, true)

//resize Frame
myGraphic.fit(FitOptions.frameToContent);

//apply Style
myGraphic.applyObjectStyle(myDoc.objectStyles.item("pics"));

}
Technical Details
Message-ID: <3bc1fea1.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,9908d369be80b7b9,start
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: georgeharell@adobeforums.com
Newsgroups: adobe.scripting.indesign
Subject: resize all pictures to page margin and apply Object Style
Message-ID: <3bc1fea1.-1@webcrossing.la2eafNXanI>
Date: Tue, 17 Oct 2006 06:15:35 -0700
Lines: 55
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing