I have an InDesign brochure that I'm trying to script against however I'm running into issues. When I try to script against the 100 page brochure I get an:

Error Number: 11274; Error String: Object is locked

When I go through the three master page layers' there is no locked layer and when I land on a page the Layer Panel still shows no locked layer on the top and child level areas. Thinking it might be a file issue I tried exporting the brochure to an IDML and opening again then saving as a new INDD but the issue still exists.

I've tried scripting:

app.activeDocument.pageItems.everyItem().locked = false;

on all the pages before tying to manipulate the zero text frame with (app.select(allPages[x].textFrames[0]);) through a for loop but the issue still occurs. Thinking it might be a master page issue I've tried:

app.activeDocument.masterSpreads.everyItem().pageItems.everyItem().locked = false;

but I still get the same results. When referencing the InDesign scripting documentation under Working with Layers the selection regarding locking layers is limited.

How can I script through an InDesign document that is producing an object lock or is there a way I can isolate the locked object?

  • What's the code line in which the error occurs?
    – mdomino
    Mar 13, 2017 at 9:39

1 Answer 1


Please try

app.activeDocument.allPageItems.everyItem().locked = false;


Normally you need to access pageItems through their page. So your app.activeDocument.pageItems... leads nowhere.

Same thing is valid for the masterspreads. They have pages as sub collection. So your code for that should be:

app.activeDocument.masterSpreads.everyItem().pages.everyItem().pageItems.everyItem().locked = false;

Also I suggest trying to find it visually. This code will walk through all pages and make the locked items magenta. It will also print messages to the ESTK.

function main () {
  var doc = app.activeDocument;
  for(var i = 0; i < doc.pages.length; i++) {
    $.writeln('\'I\'m on page ' + i);
    var page = doc.pages[i];
    for(var j = 0; j < page.pageItems.length; j++) {
      var item = page.pageItems[j];
      if(item.locked === true) {
      // do something to the page item so you can
      // find it visually
        $.writeln('found a locked item');
        item.fillColor = doc.swatches[5]; // normally it is magenta

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.