Releasing Anchored objects

I saw a couple of earlier posts with code for releasing an anchored object ( http://forums.adobe.com/click.jspa?searchID=2331267&objectType=2&objectID=1109584 and http://forums.adobe.com/click.jspa?searchID=2331267&objectType=2&objectID=2062943 ) but I'm not sure how to make this work for my current situation, so would one of you folks give me a hand, please?
I'm building a directory where business names are in one paragraph style that is a numbered list, but each of these paragraphs has anchored at the the beginning a frame containing proprietor names and phone numbers in other separate paragraph styles. I need to build an alphabetical index of stores and proprietors with the index number from the list. This actually isn't too hard to organize because I can set the numbered list style to start on next page, thereby making the list number and page number the same, but I need to release all the anchored objects so they don't get pulled in as part of the store name. I figure this should be pretty simple, so how about it? CS4, if it matters.
Peter

I didn't check the posts you mentioned, but I remembered there was a catch (an anchored object is identified only by having 'anchoredObjectSettings'). The extra try..catch surrounding the 'release' ought to shield you from oddities, as in "you can't release an anchored graphic".
Other than that ... perhaps it's easier if you can select a text frame to release everything within? Or at once everything in the entire document?

Similar Messages

  • How to release Anchored objects in an .indd file

    I need to programaticaly release anchored objects in a opened indd file so that images's coordinates could get. does any one have an idea about how to do that.
    Thanks

    I need to programaticaly release anchored objects in a opened indd file so that images's coordinates could get. does any one have an idea about how to do that.
    Thanks

  • [JS CS3] Releasing Anchored Objects

    Hello,
    The following script places a libray item as an anchored object...
    var myDoc = app.documents[0];
    var myFrame = app.documents[0].textFrames.item("myTarget");
    var myInsertPoint=myFrame.parentStory.paragraphs.item(0).insertionPoints.item(0)
    var myLibraryItem=app.libraries[0].assets[0]; myFrame=myLibraryItem.placeAsset(myInsertPoint);
    with(myFrame[0].anchoredObjectSettings){
    anchoredPosition = AnchorPosition.anchored;
    anchorPoint = AnchorPoint.topLeftAnchor;
    horizontalReferencePoint = AnchoredRelativeTo.anchorLocation;
    horizontalAlignment = HorizontalAlignment.leftAlign;
    anchorXoffset = 0;
    anchorYoffset = 0;
    How do I now release my anchored library item and then send it behind the text in the text frame "myTarget" ?
    Thanks
    Simon Kemp

    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

  • Release Anchored Objects

    Hi,
    Does anyone knows about a scrip able to release all the anchored objects in a InDesign 5.5 document?
    Thank you in advance
    Maria

    Hi Maria,
    Please use the below JS code, But the code is your requirement has been solved, i feel this way is big round circle. So any one make short your requirement after my script to edit or modify.
    var myDoc = app.activeDocument;
    var myPGItem = myDoc.allPageItems;
    for(j=0; j<myPGItem.length; j++){
        var myAncObj = myPGItem[j];
        if(myAncObj.parent.constructor.name=="Character"){
            if(myAncObj.constructor.name =="TextFrame" || myAncObj.constructor.name =="Rectangle" || myAncObj.constructor.name =="Group"){
                myAncObj.anchoredObjectSettings.releaseAnchoredObject();
    thx
    csm_phil

  • Release Anchor for grouped object

    Hi All
    How to release the Anchored object that has group of objects, Is there any property to find the anchored object with group. I need to find those anchored object with group and release the anchor, if the object is placed as inline I can find other anchor objects without group but not the one with group. How to find and release those objects through script?
    thanks
    Jason

    Hi Jason,
    About releasing anchored objects, a generic routine has been given here:
    http://forums.adobe.com/message/4062574#4062574
    Here is a slight adjustment that only targets groups:
    var a = app.activeDocument.allPageItems,
        t;
    while( t = a.pop() )
        t.isValid &&
        (t instanceof Group) &&
        (t.parent instanceof Character) &&
        (t=t.anchoredObjectSettings).isValid &&
        t.releaseAnchoredObject();
    @+
    Marc

  • Release all anchored objects at once

    Dear All, I want to release an all anchored objects from my file. All anchors are created inside the table. I am using InDesign CS4.
    I have a file for 4 pages which is containing more than 150 images to be released from anchored. That images should be placed in the same place. Only need to release. I want to do this for more than 100 files (400 pgs. it may increase in future). I tried this in Search/replace option using Object, but only i can able to find using custom option in the anchor options panel, not able to relase using search and replace.
    Please help me ASAP.
    Thanks in Advance, Thiru

    Hi Path,
    Your wrongly entered the code myDoc.ChangeText() instead of myDoc.changeText();
    Please copy my previous code and run once again i think you typed wrongly.
    Please copy and paste estk and run the script.
    var myDoc =app.activeDocument;
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.findWhat= "^a";
    myDoc.changeText();
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    mr.pathi wrote:
    Hi CSM,
    Thanks for your help. I copied this code and i run this script but while running this I am getting an error like below:
    JavaScript Error!
    Error Number: 1
    Error String: changeText
    File: C\...
    Line 4
    Source: myDoc.ChangeText();
    Could you plz check and let me know. Thanks in advance.
    thx
    csm_phil

  • Anchored objects are transparent

    Thanks in advance for the help. I am using CS5.
    I have a document were multiple anchored objects ended up overlapping each other. My problem is that the anchored objects have a transparency set to them that I cannot remove. Things to note:
    The transparency goes away if I release the anchored object.
    I have an object style assigned to the anchored frames, but there are style overrides that I cannot clear on the anchored objects.
    Changes I make to the object style assigned to the anchored objects have no effect. Only the "anchored objects options" attributes box will modify the anchored objects.
    Any help with this issue would be great. Thanks!

    You Sir, are an absolute genious! It makes absolute and perfect sence, but I guess that's what they mean by "Hindsight is 20/20."
    Thanks again!

  • Anchored Objects Disappear When Page Moved

    I'm working in InDesign CS2 in XP environment. I duplicated a page that contains anchored objects. It was page one; the duplicate page is now page 5. I modified the duplicate page 5. Now I want the altered page 5 moved into page 1 position.
    When I move the pages either by dragging or by right clicking on the page icon and using the Move Page command, all anchored objects on the page disappear. I also cannot release the anchored objects because the release command is disabled when I select an object with the selection tool.
    Any suggestions?

    I got your file, and after looking at it, it's probably better not to post it publicly. For the lurkers, it's a draft government document, not yet ready for release.
    Anyway, I took a look at the file, first in CS2 where it was created, and then in CS3 to see if it would behave differently.
    First, the anchored objects aren't really gone, just temporarily invisible. if you select the objects and move the page, you can still see the selection outline. It's some sort of screen display bug/glitch, I think, in CS2. Exporting to .inx didn't fix it, so I think it's not corruption, and it doesn't happen at all in CS3.
    The bad news is I have no way to explain what the problem is, or how to prevent it from happening. The good news is I found a way to make them reappear! Select the text frame with the selection tool, and change its stacking order. I tried Ctrl + Shift + [ to send to the back, and Ctrl + ] to bring forward, and both seemed to work, though it may make a difference where in the order they start out. If one attempt doesn't work, try again, or send all the way back or forward.
    For what it's worth, this is only a display problem. Even when the anchored objects are not visible on the screen they show in both printed and exported PDF.
    Peter

  • Anchor object question

    Hi i have this box that seem to be an anchor object, i can't figure out how i can release it to change the color of the the box at the top. Thanks

    It's a table -- not an anchored object.
    Harbs

  • New technique to place multiple anchored objects in InDesign story

    Hello,
    For a while I have been trying to figure out how to insert multiple anchored objects into an Indesign story. As far as I can tell, you cannot copy multiple objects that have already been placed in a document (such as a multi-page pdf) into an InDesign story, but must copy and paste them one-by-one into the story. This is a problem for a project I am working on where I want to have a large number of 340x52 pt pdfs to flow throughout a document in a master text frame interspersed with text.
    I have now found a solution for this issue that I thought I would share in case it would be helpful for anyone. It utilizes Automator actions for Mac OS X and Microsoft Word 2011 [2008 may work also, but I don't have a copy of that to test]; I am not good with scripting but perhaps similar solutions could be found for other systems and programs.
    1. If you want to place a multipage pdf within a text frame, first it into individual files for each page (with Acrobat Pro or pdftk or something similiar).
    2. Create an Automator service or program with the action "Create New Word Document". You can also use another automator action to save the document, or save it manually (to change the filename). In the finder, select the items you want, then run the service or drag them into the Automator program you have created.
    3. Place the word document into your InDesign story. Your items will now be anchored objects ordered in your text frame as they were in the finder.
    Please let me know if this is helpful or if anyone has suggestions for doing this process is a more efficient way. I am not sure, but it may be the case that this approach would only work on Macs, as I gather from this thread.

    I might note that I am using InDesign CS 5, and importing from a document stored in docx format.

  • Get textFrame by label returns null and anchored objects

    I have the following two functions:
    function getByLabel(page, label)
        for(var i=0; i < page.allPageItems.length; i++)
            if( page.allPageItems[i].label == label )
                return page.allPageItems[i];
    and
    Object.prototype.findItems = function(/*obj*/props)
        if( !('everyItem' in this) )
            throw new Error("Error: " + this + " is not a collection.");
        var ret = this.everyItem().getElements(),
            i = ret.length,
            e, p;
        while( i-- && e=ret[i] )
            for( p in props )
                if( (p in e) && e[p]===props[p] ) continue;
                ret.splice(i,1);
        return ret;
    In my page structure, I got one main text frame (the content area) and two vertical text fromes on the sides of the page. There is also a small box textframe on top of the page. All these textboxes EXCEPT the main text frame are ALL "ANCHORED objects". I had to make them anchored objects, eitherwise after importing data, the boxes would jump around. (Example, the small box textframe that is on the top would get moved to the content area textframe etc). Not sure if using anchored objects is the proper way to fix this.
    When I try to get the small box text frame, it does not work using the findItems (returns null) but it works fine with the getByLabel method. Why is that?
    The calling syntax is:
    for( i=0 ; i < doc.pages.length ; ++i )
            var page = doc.pages.item(i);
            var textFrame = getByLabel(page, 'lblSection' ); //This works
            //   var textFrame = page.textFrames.findItems({ label:  'lblSection' })[0]; This does not work, returns null
            if( textFrame != null )
                textFrame.parentStory.contents = "";

    (function () {
        // Per the InDesign Scripting Guide, app.activeScript is only
        // valid when a script is directly executed from InDesign, not
        // from the ESTK, so a try/catch block is recommended to handle
        // it.
        var d;
        try {
            d = app.activeScript.parent.parent.fsName;
        } catch (e) {
            d = Folder.appPackage.parent.fsName+"/Scripts";
            return d;

  • Text wrap in anchored objects

    In order to place text boxes relative to the spine, I have placed them as anchored objects.
    But now, these text frames do not respect text wrap setting from objects outside of the anchored object.
    I have made sure that ignore text wrap in text frame options is not checked.
    Is this a bug?
    And does anyone know a workaround?

    In order to make my design indifferent to later added pages, I have placed all text frames and graphic placeholders as anchored objects, positioning them relative to spine.
    When I now place an object on top of such an anchored text frame, text wrap is not working, even if i overide the master page item.
    The only work around I have found is to copy the respective text frame and make the original master page item unvisible.
    Is there not another way to to this?
    For me, the best would be another way of placing text and graphic frames relative to spine.
    Bus as soon as one overrides the master page item, the object is not placed anymore relative to spine if another page is inserted.

  • CS4 text wrap over anchored object

    Every time I place an anchored object (doesn't matter if it's graphic or text frame) and apply text wrap, Indesign freezes permanently and only solution is killing it via task manager.
    I opened CS3 file with anchored objects w/ txt wrap and the same freeze happens when trying to move, delete or apply different wrap settings to object.
    It never happened in previous version of ID on my machine.
    Any solution to this problem? Thanks.
    My PC conf.:
    AMD x2 2.7
    2GB RAM
    Vista 32bit

    The first thing to try is replacing your preferences.
    http://livedocs.adobe.com/en_US/InDesign/5.0/help.html?content=WSa285fff53dea4f86173837510 01ea8cb3f-6d1e.html

  • Anchored objects and first line in InDesign CS3

    Hi, thanks for reading. I know that when you want an achored object at the beginning of a text block to all push away ("wrap around") the text, including the first line, you have to put it into a line before that.
    What I don't like about it, is that I then have an empty first line and everything else is pushed one line down. Now I could move the whole textbox up, to fit to the rest of my layout, but that's not the way one should work in InDesign. Is there a way to get around the first line?

    T-
    Select the anchored object and put text wrap on it. Then select the anchored object and go to Object/Anchored Object/Options. Select Position: Inline and set the Y Offset to the negative number that aligns your text where you want it.

  • Is it possible to have an anchored object linked to a paragraph style?

    I want to link an anchored object to a paragraph style, so that whenever a paragraph that has a particular style is created, an anchored object is created at the same time. The particular application is to label the associate text with the anchored object. is this possible?

    Here an example for a GREP search/replace:
    Search for the beginning of every paragraph + the first character:
    ^(.)
    Replace with the formatted contents of the clipboard + the found character:
    ~C$1
    Uwe

Maybe you are looking for