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.
2 Answers
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.
-
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 CDec 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 CDec 12, 2014 at 16:47
Its Command+2 to lock, Command+Alt+2 to unlock