Copiar vínculo al Portapapeles
Copiado
I can't seem to find a simple javascript to "Unlock All Layers" for illustrator.
I just want to litterally unlock all layers 🙂
Any help out there?
Hi,
Please try following snippet to unlock all layers and sublayers in Illustartor
function unlockLayers(_layers) {
for (var i = 0; i < _layers.length; i++) {
if (_layers[i].locked) {
_layers[i].locked = false;
}
if (_layers[i].layers.length)
unlockLayers(_layers[i].layers);
}
}
unlockLayers(app.activeDocument.layers);
Let us know if this helps
Copiar vínculo al Portapapeles
Copiado
Hi,
Please try following snippet to unlock all layers and sublayers in Illustartor
function unlockLayers(_layers) {
for (var i = 0; i < _layers.length; i++) {
if (_layers[i].locked) {
_layers[i].locked = false;
}
if (_layers[i].layers.length)
unlockLayers(_layers[i].layers);
}
}
unlockLayers(app.activeDocument.layers);
Let us know if this helps
Copiar vínculo al Portapapeles
Copiado
Perfect!
Thank you!
Copiar vínculo al Portapapeles
Copiado
You're welcome 🙂
Copiar vínculo al Portapapeles
Copiado
Can you explain how to do the same for a specific layer with a name?
Copiar vínculo al Portapapeles
Copiado
Hi @Zebra
Is it single layer with that specific name or multiple layers with that name?
Copiar vínculo al Portapapeles
Copiado
Following snippet will unlock all layers with name "Test"
function unlockLayers(_layers) {
for (var i = 0; i < _layers.length; i++) {
if (_layers[i].locked && _layers[i].name == _layerName) {
_layers[i].locked = false;
}
if (_layers[i].layers.length)
unlockLayers(_layers[i].layers);
}
}
var _layerName = "Test";
unlockLayers(app.activeDocument.layers);
And if there is a single layer at top level with name "Test" then there is no need to traverse all the layers. In this case following code will be sufficient.
var doc = app.activeDocument;
try {
var _layer = doc.layers[_layerName];
if (_layer.locked)
_layer.locked = false;
} catch (e) {
alert("No layer exists with name : " + _layerName)
}
Copiar vínculo al Portapapeles
Copiado
Thanks it works perfect 👌
Copiar vínculo al Portapapeles
Copiado
Can you please explain this in laymans terms on how to accomplish this so I have access to my fonts to finish setting up an SVG file for cutting on vinyl.
I have no idea about scripting or coding. Please help me access my fonts.
error reads: Some text was on a locked layer and the font could not be replaced
Copiar vínculo al Portapapeles
Copiado
woow you are amazing man Thanks