Skip to main content
Known Participant
November 18, 2021
Question

single command to unlock document

  • November 18, 2021
  • 5 replies
  • 1352 views

I would like to unlock an entire 272 page InDesign 2022 document in one shot. I saw some answers, but didn't know how to implement a script.

This topic has been closed for replies.

5 replies

Barb Binder
Community Expert
Community Expert
November 18, 2021

Hi @The Primate:

 

When I went from the text tool to the selecton tool using (I think) <ctrl- v) I later found that tracks of text all over the document had been replaced with single "v".

The shortcut to move to the Selection tool is v (alone, just tap v) unless you have an insertion point in text, in which case you will add a v at the insertion point, which sounds like what happened. In that scenario, use Esc. This is why the tooltip shows "Selection Tool (V, Escape)".

 

~Barb

~Barb at Rocky Mountain Training
Known Participant
November 18, 2021

Thank you. I don't recall each incident but the reason why I used <ctrl-v> was that the escape key didn't always change the tool. That was another frustration for me. Maybe, as you said, I was at t an insertion point. 

Community Expert
November 18, 2021

The Primate said: "Since I needed to work while waiting for an answer, I have alreday unlocke the first 50 spreads. I still wanted an answer for the rest or for future books. "

 

What are you waiting for?

There are two scripts posted that will do what you want.

 

Regards,
Uwe Laubender

( ACP )

Known Participant
November 18, 2021

Ewe,

 

I need to spend some time on your reference to scripts. The reason why I waited is  I didn't know where the typed lines went. I am completely unfamiliar with scripts. I'll work on your solution today. What is not a delay is my gratitude for your help and the solution. 

Community Expert
November 18, 2021

Never thought so.

Just follow the steps Marc Autret gives at indiscripts.com:

https://www.indiscripts.com/pages/help#hd0sb2

 

How to save script code, just copy the script code to a text editor with no formatting, when on Windows just use the Editor application, when on Mac OS use TextEdit in the mode where no formatting of text is possible, save the pure text file with a *.jsx suffix instead of *.txt or change the suffix later on the file.

 

As a next step open the Scripts panel in InDesign, navigate to the User folder there, open the folder in your file system by using the command on the folder or invoke the context menu and finally move the *.jsx file to that folder. Executing the script from InDesign's Scripts panel can be done with the context menu or a menu command from the selected script file in the User folder. Or do a double-click on the script file in the Scripts panel of InDesign.

 

Allow the script some seconds to do its work.

 

Ah! You could also add one line at the end of my code that will alert you when the script is finished:

 

 

//ExtendScript (JavaScript) to unlock all items of a document
var doc = app.documents[0];
doc.layers.everyItem().locked = false;
doc.pageItems.everyItem().locked = false;

alert("Done!" +"\r"+ "All layers are unlocked. All items on all spreads and all parent spreads are unlocked.");

 

 

What could go wrong?

[1] You have no document open when running the script.

[2] You copied the script code to a formatted text document; that could mean, that the straight quotes in the alert are not straight anymore, but curly.

 

Regards,
Uwe Laubender

( ACP )

Community Expert
November 18, 2021

"I saw some answers, but didn't know how to implement a script."

 

If the script code is written in ExtendScript (JavaScript) see for example this:

https://www.indiscripts.com/pages/help#hd0sb2

 

The script code to unlock all items should also unlock all layers as well.

My suggestion is this:

//ExtendScript (JavaScript) to unlock all items of a document

var doc = app.documents[0];
doc.layers.everyItem().locked = false;
doc.pageItems.everyItem().locked = false;

 

Regards,
Uwe Laubender

( ACP )

Dave Creamer of IDEAS
Community Expert
Community Expert
November 18, 2021

I don't know why someone would lock individual items on a large document. Did you check the layers to see if they are locked?

David Creamer: Community Expert (ACI and ACE 1995-2023)
Known Participant
November 18, 2021

>I don't know why someone would lock individual items on a large document.

 

That doesn't answer my question. Is there a way to do it?

 

1. I unlocked all layers.

2. When I finished each spread, I locked it because I was having problems with a short cut. When I went from the text tool to the selecton tool using (I think) <ctrl- v) I later found that tracks of text all over the document had been replaced with single "v". There were other problems with photos and talk bubbles being nudged out of place. Thus one by one, I locked each finished spread to avoid inadvertent mistakes and wasted time. I couldn't just lock my text layer because I had to perfect the next spread. 

3. I am using this large documents structure to create another rather than start over.  This is why I was looking for a way to unlock all at once. Since I needed to work while waiting for an answer, I have alreday unlocke the first 50 spreads. I still wanted an answer for the rest or for future books. 

Dave Creamer of IDEAS
Community Expert
Community Expert
November 18, 2021

Sorry--I thought you received a document that was already locked. The script already posted would be your best bet. 

 

Use the Escape key to go from the Type tool to the Selection tool, not "v". 

David Creamer: Community Expert (ACI and ACE 1995-2023)
Diane Burns
Inspiring
November 18, 2021

Can you clarify what you mean by "unlock an entire xx pg InDesign document.."? Thanks.

Known Participant
November 18, 2021

For each two page spread, to unlock it, I have to press <ctrl><alt> L. A 272 page document has about 136 spreads. I was hoping there was a way I don't have to press ctrl><alt> L    132 times.

 

Lou

Community Expert
November 18, 2021

Try the following work

var a =  app.documents[0].spreads.everyItem().pageItems.everyItem().getElements()
for(var i = 0; i< a.length; i++)
	a[i].locked = false

 -Manan

-Manan