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

Problem with updating cross-references

Guru ,
Mar 18, 2017 Mar 18, 2017

Copy link to clipboard

Copied

Hi everyone,

Today I wrote a script which creates cross-references across all documents in all open documents. (I use a simple book of three documents for testing)

When the script is complete, I end up with a number of ‘outdated’ cross-references.

18-03-2017 18-51-44.png

For that reason, at the end, I added a function which updates all cross-references in all open documents:

UpdateXrefs();

function UpdateXrefs() {

    for (var i = 0; i < app.documents.length; i++) {

        app.documents.updateCrossReferences();

    }

}

But , for some reason, this doesn’t work: they still remain outdated. I tried all variations that came to my mind -- looping cross-references one-by-one forwards/backwards, using .everyItem(), tried to set the script on pause ($.sleep(10000)) before calling the update function, etc. -- but nothing works.

However, when I run the same function as a separate script, it works as expected.

Any ideas why it doesn’t work as part of the ‘main’ script?

Regards,
Kasyan

TOPICS
Scripting

Views

549

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
Advisor ,
Mar 19, 2017 Mar 19, 2017

Copy link to clipboard

Copied

are the book documents (indd's) opened when you call update?

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
Guru ,
Mar 19, 2017 Mar 19, 2017

Copy link to clipboard

Copied

LATEST

Yes, the script opens all the documents in the active book at start.

— Kas

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