Article View: adobe.scripting.indesign
Article #9737Re: Release anchored objects of a story
From: Dave_Saunders
Date: Fri, 21 Jul 2006 18:08
Date: Fri, 21 Jul 2006 18:08
27 lines
1900 bytes
1900 bytes
The thing is, in the object model, there is no such thing as "an anchored object" for such a method to operate upon.
The way to find out if an object is anchored is to check to see if its parent is a character. Or, you can use more esoteric methods like asking for myObj.anchoredObjectSettings.anchorPosition -- if that gives you an error, the object is not anchored.
I supposed that there could be a generic method that did this, but it would have to be prepared to give error messages if called for an object that was not anchored.
Now that raises a point: in the UI, it looks as though inline objects are just a special case of anchored objects, but Release doesn't work for inlines.
We could write a script that would work for inlines, too. This method gets the job done:
//DESCRIPTION: Test for Anchored Object Release method
Object.prototype.releaseAnchored = function() {
if (this.parent.constructor.name != "Character") throw "Holy Cow!"
this.select(SelectionOptions.replaceWith);
var myBounds = this.geometricBounds;
app.cut();
app.paste();
app.selection[0].move([myBounds[1], myBounds[0]]);
return app.selection[0]
}
app.selection[0].releaseAnchored();
I'm not sure why you wanted to use another layer.
Dave
Technical Details
Message-ID:
<3bc0fe9c.2@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!feeder.news-service.com!syros.belnet.be!news.belnet.be!news.stben.net!webcrossingReferences:
<3bc0fe9c.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,26971fcf4ed8261a X-Google-Attributes: gidf939a,public X-Google-Language: ENGLISH,ASCII-7-bit From: Dave_Saunders@adobeforums.com Newsgroups: adobe.scripting.indesign Subject: Re: Release anchored objects of a story Message-ID: <3bc0fe9c.2@webcrossing.la2eafNXanI> Date: Fri, 21 Jul 2006 11:08:20 -0700 References: <3bc0fe9c.-1@webcrossing.la2eafNXanI> Lines: 36 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news.germany.com!feeder.news-service.com!syros.belnet.be!news.belnet.be!news.stben.net!webcrossing