Skip to main content
Participating Frequently
November 14, 2023
Question

Document disclaimer update chaos

  • November 14, 2023
  • 6 replies
  • 1543 views

Hi everyone! Long shot, but is there a way build dynamic function/fields into InDesign or some other magical Adobe space so that text can be updated in one spot but populate all files tied to it? We have built all of our collateral with a parent/master template (InDesign files) so if we update a disclaimer on that it does update once you open corresponding InD docs. That great but still becomes manual. I feel like I'm missing something in Bridge or some space where a disclaimer update can be much more automated.  Thanks for any insights!

This topic has been closed for replies.

6 replies

Participant
December 1, 2023

Hi, Mark! I work with Sarah and I have installed the scripts you shared on my local machine, however I have a question if you  don't mind humoring me. It appears as if the scripts you shared are dependant on the disclaimer text being a linked file, not simple text that livers directly within a document. Am I correct? (Such as an external Word file Placed within InDesign.)

m1b
Community Expert
Community Expert
December 1, 2023

Hi @aaronajds_21, they only work with links. The scripts are to speed up the following manual process.

You've edited the *master* disclaimer text file (or graphic—it doesn't matter what kind of file)

Step 1: Open all the documents that have the disclaimer linked.

Step 2: Update modified content (in links panel) in all document.

Step 3: Save all documents.

 

Therefore if the disclaimer file isn't *linked* there is nothing in the links panel to update and these scripts are useless. If there are some disclaimers using the link and others are not linked, I would hope you are able to fix them so they are all linked. Have I understood you right?

- Mark

m1b
Community Expert
Community Expert
November 14, 2023

Hi @Sarah33611737dz2d, you've got a lot of excellent correct advice here already but, from what you say, I think you are already handling things very well, and your problem is actually how do I update hundreds of indesign documents without manually opening each one? 

 

If that is your problem, I've written two scripts that should help anyone in your situation. The idea is that you keep a text file which stores the paths of all the documents which contain a link to the disclaimer and, whenever the disclaimer is edited, you run the second script below and it automatically does the updating. The two scripts are:

 

1. "Add Open Documents To List File.js" — This is a helper script that adds the paths of every open document to a text file called "documents to open.txt" saved in the same folder as the script file. To use it, open your documents that have the disclaimer link in them and run the script. Note: you don't have to do these all at once—you can add them piecemeal if you prefer. Also note that the script will always add the document paths to the file—even if they are already in it. You can freely edit this text file if it gets messed up. Just keep one path per line.

 

2. "Open And Update Listed Documents.js" — this is the script you will use whenever your disclaimer is changed. It opens every document in the text file, one-by-one, and updates, saves and closes each, and it will tell you what it completed at the end.

 

Put these two scripts in the same folder, as they read/write to the same text file. The script listings are below. If you end up trying them, let me know how it goes!

- Mark

 

Script 1:

/**
 * @file Add Open Documents To List File.js
 * Add all open documents to "documents to open.txt" file,
 * for later use with "Open and Update Listed Documents.js" script.
 * @author m1b
 * @discussion https://community.adobe.com/t5/indesign-discussions/document-disclaimer-update-chaos/m-p/14234094
 */
(function () {

    var docs = app.documents,
        fileName = 'documents to open.txt',
        dataFile = File(File($.fileName).parent + '/' + fileName),
        documentList = getLinesFromFile(dataFile, ''),
        counter = 0;

    docLoop:
    for (var d = 0; d < docs.length; d++) {

        documentList.push(String(docs[d].fullName));
        counter++;

    }

    try {
        // write the list back to file
        dataFile.open('w');
        dataFile.write(documentList.join('\n'));
    }
    catch (error) {
        alert('Failed to write to "' + fileName + '". (' + error + ')');
    }
    finally {
        dataFile.close();
    }

    alert('Added ' + counter + ' documents to "' + fileName + '".');

    dataFile.execute();

})();



/**
 * Returns list of every line of a given text file.
 * @author m1b
 * @version 2023-11-15
 * @param {File} f - the file to open/create.
 * @param {String} emptyFileMessage - instructions added to newly created file.
 * @returns {Array<String>}
 */
function getLinesFromFile(f, emptyFileMessage) {

    var data = [];

    try {

        if (f == undefined)
            return;

        if (!f.exists) {
            // create empty data file
            f.open('w');
            f.write(emptyFileMessage);
            f.execute();
            return [];
        }

        // read contents and split into lines
        f.open('r');
        data = f.read().split('\n');

    } catch (error) {
        alert('Failed to open "' + decodeURI(f.name) + '". (' + error + ')');
        return [];
    }

    finally { f.close() }

    return data;

};

 

Script 2:

/**
 * @file Open And Update Listed Documents.js
 * Open all documents whose path is listed in
 * "documents to open.txt" file, then update links,
 * and save and close document.
 * @author m1b
 * @discussion https://community.adobe.com/t5/indesign-discussions/document-disclaimer-update-chaos/m-p/14234094
 */
(function () {

    var uilevel = app.scriptPreferences.userInteractionLevel;
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT

    var fileName = 'documents to open.txt',
        dataFile = File(File($.fileName).parent + '/' + fileName),
        documentList = getLinesFromFile(dataFile, 'Remove this line and add document file paths here, one per line.'),
        messages = [],
        docCounter = 0,
        linkCounter = 0;

    docLoop:
    for (var d = 0; d < documentList.length; d++) {

        if (
            documentList[d] == undefined
            || documentList[d] == ''
        )
            continue docLoop;

        var f = File(documentList[d]);

        if (!f.exists)
            messages.push('Document on line ' + d + ' does not exist. (' + decodeURI(f) + ')');

        var doc = app.open(f),
            links = doc.links,
            closeDoc = true;

        // find missing links
        linkLoop:
        for (var l = 0; l < links.length; l++) {

            if (links[l].status === LinkStatus.LINK_OUT_OF_DATE) {
                links[l].update();
                linkCounter++;
            }

            else if (links[l].status === LinkStatus.LINK_MISSING)
                closeDoc = false;

        }

        if (closeDoc) {
            doc.close(SaveOptions.YES);
            docCounter++;
        }

    }


    // messages.push('Added ' + counter + ' documents to "' + fileName + '".');
    messages.push('Updated ' + linkCounter + ' links in ' + docCounter + ' documents.');

    app.scriptPreferences.userInteractionLevel = uilevel;
    alert(messages.join('\n'));

})();


/**
 * Returns list of every line of a given text file.
 * @author m1b
 * @version 2023-11-15
 * @param {File} f - the file to open/create.
 * @param {String} emptyFileMessage - instructions added to newly created file.
 * @returns {Array<String>}
 */
function getLinesFromFile(f, emptyFileMessage) {

    var data = [];

    try {

        if (f == undefined)
            return;

        if (!f.exists) {
            // create empty data file
            f.open('w');
            f.write(emptyFileMessage);
            f.execute();
            return [];
        }

        // read contents and split into lines
        f.open('r');
        data = f.read().split('\n');
    }
    catch (error) {
        alert('Failed to open "' + decodeURI(f.name) + '". (' + error + ')');
        return [];
    }
    finally {
        f.close();
    }

    return data;

};

 

Joel Cherney
Community Expert
Community Expert
November 14, 2023

Honestly, I like this solution a lot better than the solution I was cooking up (tag up the disclaimer for XML import, store an XML file with the disclaimer in a universally accessible location, then go around and install a script on everyone's workstation that would run on opening any INDD, look for the XML file, look for the disclaimer, and if the disclaimer is present, update tagged content). 

 

The main reason I like Mark's solution better: there's no step that says "Late at night, when there's no one in the office, creep around to everyone's machine and install this script."

m1b
Community Expert
Community Expert
November 14, 2023

Hey Joel, your idea is really clever, and would be excellent in the right situation. I imagine if the disclaimer was a company-wide asset that was updated frequently, on basically every document ever created in the company, this could be great. Additionally, the script could void the document somehow (by adding a watermark or other warning) every time the document was saved, so that the script would have to un-void it (at the same time as updating disclaimer or whatever) on opening which would ensure the update happened. This would be an attempt to handle situations where someone opens the document on a machine without the startup script—the document would be void. Who knows how well that would work in the real world though.

 

A possible downside would be that when an Indesign upgrade occurs (eg. 2023 -> 2024), the startup script would have to be placed in the app folder again. More late night sneaking!

 

My idea is probably more tied to the disclaimer update event, so that the person who updates the disclaimer also updates all the documents that use it, and then the disclaimer update is done and over with.

 

Always cool thinking about possible options.

- Mark

Lukas Engqvist
Community Expert
Community Expert
November 14, 2023

You can place an indesign file in an indesign file, or a cloud asset, as long as the file is available it will update (or ask to be updated) when you open the file with the link. (You can also place a linked text, xml and/or insert HTML code, but I think CC Library Asset is the simplest if available to you)

Participating Frequently
November 14, 2023

Thank you!

 

James Gifford—NitroPress
Legend
November 14, 2023

Many good answers, but also consider placing a linked PDF, as something that can be easily changed but with a more controlled extra step,  over a placed INDD.

Participating Frequently
November 14, 2023

Thanks. Can you clarify this a bit further?

James Gifford—NitroPress
Legend
November 14, 2023

Create the disclaimer in ID and export to PDF, ideally with a page size of how large you want or need it to be (e.g. 6x2 inches or whatever). Place (link) that PDF in the live docs. Any update to the PDF will automatically update in the docs, but is protected against accidental or unwanted changes. 

Joel Cherney
Community Expert
Community Expert
November 14, 2023

I can think of quite a few ways to do this. My personal favorite is to have a single InDesign document that has the disclaimer in it, which you then place into your other InDesign documents. This is, I suppose, technically still "manual" insofar as you'd need the preference setting to update links on open turned on. That way, if the disclaimer INDD was changed, you'd get this dialog whenever you opened another INDD that had the disclaimer placed within it:

 

 

Is this... too manual? It sounds pretty close to what you already have set up, I suspect. I personally don't think it's a good idea to have such template text update silently, but that's a workflow preference of my own that you might not share.  It's possible to have a script run every time a document is opened; I bet that there are a few ways one could set that up to silently update some kind of content. I have some JS (and some Applescript) in my unfinished-script-experiments folder that are clearly experiments towards this kind of silent-update-on-open with content stored in XML.  Seems like a heavyweight solution in comparison to clicking on "Update Modified Links" upon opening a file, but in someone else's workflow it might be an important feature. 

 

 

Participating Frequently
November 14, 2023

Thank you, Joel. Yes, that is our current testing solution and I appreciate your thoughts. While I normally classify myself as a 'control enthusiast' and the thought of silent script updates sounds like true chaos, we are managing nearly thousand pieces of collateral now and the library continues to grow. We are required to have the corporate disclaimer on at least one page of each brochure/fact sheet/template and we've acquired some services that required two leagl updates to the disclaimer - this year alone. We have a small creative team and I'm trying every solution to help my team for the next update request. 

Participating Frequently
November 14, 2023

*legal updates 
Please excuse my typos! 

Steve Werner
Community Expert
Community Expert
November 14, 2023

This InDesign Help file on linked content is what InDesign has available for linked content:

 

https://helpx.adobe.com/indesign/using/linked-content.html

Participating Frequently
November 14, 2023

Thanks Steve. This is definitely helpful information and we can test this further. If you know of additional, robust automation features, do let me know please!