Search code examples
javascriptadobe-indesignextendscript

Is it possible to suppress CheckOut/CheckIn dialogs in Extendscript?


I have a script with a function that checks out a document's first story. When I run this, a dialog pops up asking whether I want to update the text to the latest version. Since this function runs several times per run of the script, I want to suppress this dialog by replying yes every time. Is there a way to automatically say yes to these dialogs as they come up, or just suppress them with an automatic response?

function doccheckout(doc) {
    // get the main story
    var stories = doc.stories
    var story = stories.firstItem()
    // check out the main story
    story.checkOut()
    }

The same thing happens when I close out the document with document.checkIn(), so I'd like to suppress that one as well, but I assume any solution to the first part will be applicable to the second.

Relevant popups

enter image description here


Solution

  • Try to disable the user interaction:

    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
    // your code here
    //
    // at the end of your script reset it to the default
    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;