🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #2199

Re: [JS CS3] Releasing Anchored Objects

#2199
From: Skempy
Date: Mon, 05 Jan 2009 16:28
17 lines
2297 bytes
Thanks Harbs, this has made things simpler.

I have heard your name mentioned several times today in the InDesign Secrets podcast (and Dave's too).

I am almost there with the script (my scripting is clumsy but I can usually get things to work mainly with help from this forum.

My last problem is that I am re-applying geometric bounds to the released anchored object as it is still being referenced as myAnchoredFrame.

Is it possible to release ALL the anchored objects in one go? Or how do I dump the reference to myAnchoredFrame once it has been released?

var myTextFrame = app.documents[0].textFrames.item("myTarget");
var myParagraphs = myTextFrame.paragraphs
for (var i = 0; i <= myParagraphs.length-1; i++) { var nLines = myParagraphs.item(i).lines.length; var myAnchoredFrame = myTextFrame.paragraphs.item(i).insertionPoints.item(0).textFrames.add(); var myHeight = nLines*myParagraphs[i].leading*.353 myAnchoredFrame.geometricBounds = [0, 0, myHeight, (myTextFrame.geometricBounds[3]-myTextFrame.geometricBounds[1])]; myAnchoredFrame.fillColor = "Gradient"; myAnchoredFrame.gradientFillAngle = 90; myTextFrame.texts.item(0).recompose; with(myAnchoredFrame.anchoredObjectSettings){ anchoredPosition = AnchorPosition.anchored; anchorPoint = AnchorPoint.topLeftAnchor; horizontalReferencePoint = AnchoredRelativeTo.anchorLocation; horizontalAlignment = HorizontalAlignment.leftAlign; verticalReferencePoint = VerticallyRelativeTo.capheight; verticalAlignment = VerticalAlignment.topAlign; anchorXoffset = 0; anchorYoffset = -1; pinPosition = false } myAnchoredFrame.anchoredObjectSettings.releaseAnchoredObject () myAnchoredFrame.sendToBack(); }

Thanks again

Simon Kemp
Technical Details
Message-ID: <59b7683a.6@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news2!newshub.sdsu.edu!webcrossing
References: <59b7683a.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,f8aa02f04e7a8179
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Skempy@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.glorb.com!news2!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: [JS CS3] Releasing Anchored Objects
Message-ID: <59b7683a.6@webcrossing.la2eafNXanI>
Date: Mon, 5 Jan 2009 08:28:18 -0800
References: <59b7683a.-1@webcrossing.la2eafNXanI>
Lines: 44
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit