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

Release all anchored objects at once

Explorer ,
Dec 04, 2011 Dec 04, 2011

Copy link to clipboard

Copied

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

Views

28.9K

Translate

Translate

Report

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

Votes

Translate

Translate
Mentor ,
Dec 04, 2011 Dec 04, 2011

Copy link to clipboard

Copied

it seems your question already answered.

take a look here:

http://forums.adobe.com/message/2609468#2609468

Votes

Translate

Translate

Report

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 04, 2011 Dec 04, 2011

Copy link to clipboard

Copied

Thanks for your reply. But I am new to scripting, so i am not able to make that script completely. So could you plz give me the full code of the script?

For more information:

The file contains Inline anchored object and custom anchored objects in the table. And there is no link between frames. Each page having separate frame.

Votes

Translate

Translate

Report

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 04, 2011 Dec 04, 2011

Copy link to clipboard

Copied

Hi Pathi,

Please try the below js code is simple way to remove the anchored object for all the page.

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

thx

csm_phil

Votes

Translate

Translate

Report

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 04, 2011 Dec 04, 2011

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Hi CSM,

I am sorry, I only copied the content from here to my script. So there it was correct only. When i replied a mail to you that time only i entered wrongly

the code myDoc.ChangeText() instead of myDoc.changeText(); .

So my script is correct as what you gave me. Its showing me the error:

JavaScript Error!

Error Number: 1

Error String: changeText

File: C\...

Line 4

Source: myDoc.changeText();

sorry for the inconvenience. Thanks in advance.

Votes

Translate

Translate

Report

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
Mentor ,
Dec 05, 2011 Dec 05, 2011

Copy link to clipboard

Copied

hi Pathi,

Phil's script works, so better take a second look for copy-paste or somewhat errors on your side. Unfortunately, it not just releases anchores, it deletes them. This is not what you want, if I got your request.

Maybe Phil could adjust his code by chance?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Hi winterm and CSM,

@winterm : you are right. Its working fine as you said, its just deleting all anchored images also. But i dont want this, I want that images and should be placed in same place. It should just release from anchored.

I have below script, even its working for normal file but its not working for the files which are need to release.

if(app.documents.length!=0) {

    var ad = app.activeDocument;

    var pgit = ad.pageItems;

    var pgitlg = pgit.length;

    var objprocessed = 0;

    if(pgitlg !=0)

    {

        for(i=0; i<pgitlg; i++)

        {

            if(pgit.getElements()[0].constructor.name == "TextFrame")

            {

                var tfg = pgit.allGraphics;

                var tfglg = tfg.length;

                for(j=0; j<tfglg; j++)

                {

                    var rec = tfg.parent;

                    rec.anchoredObjectSettings.releaseAnchoredObject();

                }

            }

        }

    }

}

I have a file which i need to release from anchor, plz let me know how to share that file through our forum.

thanks

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Hi Pathi,

i have tested the above js code its working fine, But still i dont know what is your expectations. Can you please provide the snapshot before and after.

thx

csm_phil

Votes

Translate

Translate

Report

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
Guide ,
Dec 05, 2011 Dec 05, 2011

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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
People's Champ ,
Dec 05, 2011 Dec 05, 2011

Copy link to clipboard

Copied

Cute! But a little hard to debug!

Is it ok to rely on the order of the Javascript interpreter like that?

Ariel

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Hi Marc,

Thanks, I will check and let u know...

Thanks

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Hi Marc,

I was amazed, this is what i expected. Its working fine, thanks a lot. You saved me a lot of time and work....

tks

Thiru

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Hi Marc,

Could you suggest any tutorial (any website) to learn js from basic for InDesign, please? I dont have any background knowledge about programming...

Tks in advance

Votes

Translate

Translate

Report

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 16, 2012 Aug 16, 2012

Copy link to clipboard

Copied

Hi guys,

Could some one please send me the .jsx file to release all anchors? I'm really struggling here, am new to scripting and can't figure it out! Or is there somewhere I can download it?

Thanks so much

Votes

Translate

Translate

Report

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 17, 2012 Aug 17, 2012

Copy link to clipboard

Copied

Copy the text in the white box in post #11. Use ESTK (ExtendScript Tool Kit) or any text editor and paste the text from above. Save the file as plain text with the .jsx extension. Place the file in HD/Applications/Adobe InDesignCSx/Scripts/Scripts Panel. Restart ID and with a file open, go tom menu Window>Utilities>Scripts and double-click on the script to run it.

Votes

Translate

Translate

Report

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 17, 2012 Aug 17, 2012

Copy link to clipboard

Copied

> .. Restart ID ..

Not necessary at all to quit ID! As soon as you place a new script in the ascrts folder, you'll see it magically appear in the Scripts Panel. (Also, if you saved it at what you think was the right place and it does not appear, you used the wrong location.)

Votes

Translate

Translate

Report

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 17, 2012 Aug 17, 2012

Copy link to clipboard

Copied

I guess I'm too used to AI which requires a restart to add the file to it's list.

Votes

Translate

Translate

Report

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 17, 2012 Aug 17, 2012

Copy link to clipboard

Copied

That explains it. 🙂

I'd love to hear Adobe's explanation, though, about this stuff lagging behind in Illustrator, while the Script Panel and its behavior has been unchanged since *at least* CS, and probably before that as well. (For once that's actually a GOOD thing to leave exactly as it is!)

Votes

Translate

Translate

Report

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 ,
Jul 17, 2018 Jul 17, 2018

Copy link to clipboard

Copied

I do not understand pogramming and wonder why am I having to deal with this.  It is not something I knowingly applied to my work on InDesign.  I need a simple solution to this problem, preferably from the menus above my work.  I do not want anything anchored or locked.

Votes

Translate

Translate

Report

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 ,
Jul 17, 2018 Jul 17, 2018

Copy link to clipboard

Copied

cmburdet5  wrote

I do not understand pogramming and wonder why am I having to deal with this.  It is not something I knowingly applied to my work on InDesign.  I need a simple solution to this problem, preferably from the menus above my work.  I do not want anything anchored or locked.

You can always do feature requests or feature modification requests here:

Adobe InDesign Feedback

FWIW:

You replied in the InDesign Scripting forum.

So it's no wonder that we discuss programming or scripting issues here.

Regards,
Uwe

Votes

Translate

Translate

Report

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 ,
Jul 17, 2018 Jul 17, 2018

Copy link to clipboard

Copied

Well, I'd regard this -- a custom script that does exactly one custom job and nothing more -- the "simple" method. Learning how to install a script and run it is not extremely hard at all and it does not need any scripting knowledge either.

The alternative, currently, is indeed releasing all objects one by one using the standard interface. Now that is simple and should be doable by anyone with some previous InDesign experience.

Of course it is entirely possible to add a menu item called "I don't want any locked or anchored objects" (unless there is a length limit on menu items, we'll have to try and see how that works out). But there remains the problem: if you don't know how to install a script and don't want to learn that, how are we going to get it on your computer?

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Hi Marc,

               how to Find Anchored text frames and objects

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

hi

Votes

Translate

Translate

Report

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