Does anyone know of a script or an easy method of deleting hidden layers in Illy? I have several files with extra data layers that were used to help make the maps, but I no longer need these layers. Rather then deleting them one-by-one I'm wondering if I could just automatically delete all the layers that are not visible.
Delete hidden layers - Illustrator
Started by
Mike Boruta
, Aug 09 2011 04:21 PM
5 replies to this topic
#1
Posted 09 August 2011 - 04:21 PM
#2
Posted 11 August 2011 - 04:53 PM
Does anyone know of a script or an easy method of deleting hidden layers in Illy? I have several files with extra data layers that were used to help make the maps, but I no longer need these layers. Rather then deleting them one-by-one I'm wondering if I could just automatically delete all the layers that are not visible.
The following js code should delete all layers in a doc that are not visible. If you have sublayers you want to deal with too, you'd have to add another loop in there to look through sublayers of each layer...
#target illustrator
var myDoc=app.activeDocument;
var layerCount=myDoc.layers.length;
for (var ii = layerCount - 1; ii >= 0; ii--) {
var currentLayer = myDoc.layers[ii];
currentLayer.locked = false;
if (currentLayer.visible == false){
currentLayer.visible = true;
currentLayer.remove();
}
}
edit to add: for some reason the indents didn't show up in my post...
#3
Posted 11 August 2011 - 06:42 PM
Thanks Brian. Although I really don't know much about coding. The only scripts I've used in Illy are ones that other people have made and I've added to the Scripts folder. Forgive my ignorance, but how would I save this in a way to use with Illy (preferably in a way that would also look through a documents sublayers)?
#4
Posted 12 August 2011 - 06:51 PM
Mike-
attached is the above code saved as a jsx script... just use it as other scripts you've used in AI. Hope it works for you.
attached is the above code saved as a jsx script... just use it as other scripts you've used in AI. Hope it works for you.
Attached Files
#5
Posted 14 August 2011 - 01:51 PM
That works great. How hard would it be to modify the script so that it also deletes hidden sublayers?
#6
Posted 24 August 2011 - 09:30 PM
That works great. How hard would it be to modify the script so that it also deletes hidden sublayers?
Hi-
Sorry, I don't often check in here. I modified that script to delete hidden sub-layers too. Hope it works for you.
Attached Files
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users


Sign In
Create Account

United States
Back to top









