Advertisement


Toggle Illustrator Layer visibility?


Question

I am looking for a way, preferably one that can be triggered via keyboard shortcut, to both toggle the current layer to visible/hidden and to be able to toggle a specifically-named layer visible/hidden.

What I am aiming for with the specifically-named layer visibility toggle is to turn the template layer visible/hidden.

It would be great to be able to toggle without selecting the layer, but I'd take that option if that were all there was. Both would be ideal.

This Adobe forum post seemed to be the solution via scripting, until I realized it was for Photoshop, not Illustrator (handy nonetheless).

2016/05/11
1
3
5/11/2016 4:18:00 PM

Accepted Answer

No problemo.

#target illustrator

layer = app.activeDocument.layers.getByName("Toggle")
layer.visible = ! layer.visible

Put this in a action and bind action to shortcut. NOTE: Adobe has no quality control for their scripting environment so the actions pallete will forget the script each time you start Illustrator so to get this working reload the default actions again and it works. Simply put actions palette is just initialized too early.

Update The load problem is now fixed after 10 years of waiting

2017/11/09
5
11/9/2017 8:27:00 AM