Show/Hide layers with script
Posted: Wed Nov 29, 2017 11:23 pm
Hello all,
I'm using and in two scripts to hide/show some layers with certain names. You can download the attached .js files with the scripts and one test drawing to verify try them if you want. The two commands should have the commitment of hiding or showing all layers whose names are starting with "0" and having one or two additional characters after (so maximum 3 characters layer names). You can try them by command line typing "ch0off" or "ch0on".
The thing is, right now, this two scripts are only partially working. If I hide "manually" one of these layers clicking on the visibility switcher (eye icon) on the Layer List, then the command "ch0on" is not working. The same thing happens if I isolate another current layer with Y,O; after that "ch0on" doesn't work.
About "ch0off", seems it's working as expected in any case.
I guess I'm misunderstanding the behaviour of. So, which is the variable I should use?
I also would like to create another script to isolate all layers starting with "0" as well.
Thanks for your support. Best regards,
David
I'm using
Code: Select all
layer.setFrozen(true)
Code: Select all
layer.setFrozen(false)
The thing is, right now, this two scripts are only partially working. If I hide "manually" one of these layers clicking on the visibility switcher (eye icon) on the Layer List, then the command "ch0on" is not working. The same thing happens if I isolate another current layer with Y,O; after that "ch0on" doesn't work.
About "ch0off", seems it's working as expected in any case.
I guess I'm misunderstanding the behaviour of
Code: Select all
layer.setFrozen(false)
I also would like to create another script to isolate all layers starting with "0" as well.
Thanks for your support. Best regards,
David