Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
5

Release all anchored objects at once

Explorer ,
Dec 04, 2011 Dec 04, 2011

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

TOPICS
Scripting
30.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Dec 05, 2011 Dec 05, 2011

Try this:

var a = app.activeDocument.allPageItems, t;

while( t = a.pop() )

    {

    t.isValid &&

    t.hasOwnProperty('anchoredObjectSettings') &&

    (t.parent instanceof Character) &&

    (t=t.anchoredObjectSettings).isValid &&

    t.releaseAnchoredObject();

    }

@+

Marc

Translate
Community Expert ,
Oct 26, 2017 Oct 26, 2017

Look at the dates of this thread. You are reviving a question thread that is nigh on 6 years old. (And with a relatively unrelated question as well.) Please observe proper netiquette and post new questions as new questions.

Also, if you tried to do so yourself: include what you tried, what didn't work, what error you got etc.

If you need a fully custom script written from scratch, and someone has the time to help you out for free, you're in luck. Else just hire someone.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 02, 2023 Nov 02, 2023

Hi there,

I've read this thread, and it all makes sense, but I can't get it to work. Perhaps things have changed a lot since 2017. I've created a jsx file, which i execute from the script panel in inDesign. it contains the following:

var a = app.activeDocument.allPageItems, t;

while( t = a.pop() )
    {
    t.isValid &&
    t.hasOwnProperty('anchoredObjectSettings') &&
    (t.parent instanceof Character) &&
    (t=t.anchoredObjectSettings).isValid &&
    t.releaseAnchoredObject();
    }

However, all my objects are still anchored.

I'm on inDesign 19v. 

Any help would be appreciated. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2023 Nov 03, 2023

That's because Marc's script deals only with anchored objects, not with inlines. So inline frames should be converted to anchored frames, then released. For some reason that can't be added to Marc's script (I can't, anyway), it needs something different:

var a = app.activeDocument.allPageItems;
for (var i = a.length-1; i >= 0; i--) {
  if (a[i].parent instanceof Character) {
    try {
      a[i].anchoredObjectSettings.anchoredPosition = AnchorPosition.ANCHORED;
      a[i].anchoredObjectSettings.releaseAnchoredObject();
    } catch (_) {
    }
  }
}

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 16, 2024 Jan 16, 2024

Thank you so much Peter! Exactly what I was looking for, it would be even more if all released inline objects could have a wrap around the bounding box so that they don't move in the layout.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 10, 2021 Aug 10, 2021

Look for ~a (in the Grep tab of the Find/Change window).

You can find it in the flyout menus of the Find/Change window

PeterKahrel_0-1628579628239.pngexpand image

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 24, 2018 Jun 24, 2018

I suffer from this problem please

How can I put this script in indesign

I opened notepad file and pasted this code in it and clicked save , closed the file

opened it and went to file , save as , changed its extension to jsx

Put it in C:\Program Files\Adobe\Adobe InDesign CC 2018\Scripts\Scripts Panel\Samples\JavaScript

restarted indesign biu the code don't run

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 25, 2018 Jun 25, 2018

Hi romeozzzzzzz ,

for using and installing ExtendScript scripts with InDesign see:

Indiscripts :: Indiscripts for Dummies

Just a note on the offered code here. Three things that can go wrong:

1. The anchored object is part of overset text. Released objects that are anchored in anchored objects could be removed.

2. The anchored object is anchored inline or anchored above line and method releaseAnchoredObject() will not work.

3. The anchored object released will not stay in position.*

* EDIT: When Inline and Above Line anchored object are duplicated and originals are removed as alternative to using method releaseAnchoredObject() that is only working with anchored anchored frames.

Regards,
Uwe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 05, 2011 Dec 05, 2011

Hi CSM,

Thanks for your effort in this, yah you are right its working good. But for some files it is not working.

I would like to share that file with you all to test file. Plz let me know how to share that with this forum? or plz give me any email id and i will send you that file.

Thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 25, 2017 Oct 25, 2017

HI csm

                 To add an Element and attribute as image in doc.Image is in Anchored text frame image also in Anchored ,I tried to add Indesign Quiet automatically.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Dec 05, 2011 Dec 05, 2011

Hi Pathi,

Please try the below js code, Otherwise you can post your full code  i will check and clear your problem.

app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
app.findTextPreferences.findWhat= "^a";
app.activeDocument.changeText();
app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

thx

csm_phil

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 12, 2017 Jan 12, 2017

Wanted to add something to this old thread about the script to release all anchored objects.

If you double click it and nothing happens, it may be because the objects are considered un-releasable by InDesign. Like if you click one and go to the anchored objects menu, the release option is grayed out. This may be a bug or have to do with grouping.

You can fix it by clicking within the text box containing those objects, doing select all, and then going up to object - anchored object - Options. Then change the position dropdown to "Custom". At this point the objects may all collapse together since they no longer have their previous position settings... but they will now be allowed to release. At this point the script should work.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 08, 2021 Aug 08, 2021

Thanks a lot!

 

Carolina Porto Ruwer
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 09, 2021 Aug 09, 2021

Hi CreeDeaux,

as you said: One can only release "custom" anchored objects.

 

It's the same with scripting. A script has to change the kind of anchoring first, only then is the method for releasing the anchored object available. I think this is not a bug, just a missing feature.

 

Also note:

For a single instance you could also cut the anchored object and paste it in place.

Unfortunately that could fail so that the position on the page is not the original one when anchored.

A script can correct that as well and move the un-anchored object to the right position.

 

Regards,
Uwe Laubender

( ACP )

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 30, 2020 Jan 30, 2020

Here's my effort, building on Marc's work: https://gist.github.com/mhjb/5f78dee507754f0871891efe2c70d5ba

This script 'frees' & styles all anchored texts in a document, replacing anchors with the contained text

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 27, 2021 Sep 27, 2021

Ravi

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 25, 2023 Oct 25, 2023

There really needs to be a script to release ALL anchored objects in a document, similar to how Break All Text Threads works.

This script is very helpful, as you can release an anchored object with one click, but you still have to individually click on every single anchored object which is massively tedious.

https://creativepro.com/releasing-inlines/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 27, 2023 Oct 27, 2023

What's wrong with the script that Marc Autret posted (see the answer marked as correct)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 30, 2023 Oct 30, 2023

Woah!  I didn't see there was a correct script.  This is phenomenal!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 09, 2024 Aug 09, 2024

Worked like a charm

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 18, 2025 Feb 18, 2025
LATEST

BIUTTT

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines