5

Is it possible to toggle the locked/unlocked state of the current layer via keyboard shortcut? I'd love to be able to toggle show/hide for layers as well.

1
  • I don't think so. And it's not in the keyboard shortcuts. So, I think you'd need scripting.
    – Scott
    Dec 9, 2014 at 21:34

2 Answers 2

4

here's a one-liner script that toggles active layer visibility

app.activeDocument.activeLayer.visible ^= 1;

this other one-liner toggles lock/unlock

app.activeDocument.activeLayer.locked ^= 1;

install those 2 scripts into your default scripts folder, then create two actions to run them, assign them shortcut keys and you're all set.

4
  • Those scripts worked perfectly, but I was not able to create an action that used them. And in the past, Actions which used scripts in Illustrator were not retained after quitting and relaunching. I am using CS6, what version are you on? Thanks.
    – George C
    Dec 11, 2014 at 2:26
  • Hi George, you have to use "Insert Menu Item..." in the Action's panel flyout menu to be able to record scripts. Dec 11, 2014 at 7:57
  • ...correct, Actions don't survive a restart, that's a decades long bug Adobe doesn't want to address or is unable to fix, either option is bad for the "leading" design software company...the workaround is to Save your actions and reload them after relaunching, far from perfect flow, but better than re-recording. Dec 11, 2014 at 8:10
  • I forgot about "Insert menu item", thanks. Good to know on reloading actions, I didn't know that was a workaround. Too bad I can't set up reloading Actions as an Action! But agreed, that is an easier method than recreating. Thank you.
    – George C
    Dec 12, 2014 at 16:47
-2

Its Command+2 to lock, Command+Alt+2 to unlock

1
  • Those commands only work for objects, not for layers.
    – George C
    Jan 10, 2015 at 1:36

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