Answered
Indesign script to lock layers with specific names
Is it possible to create a script that locks layers with specific names? All our documents have a 'CMYK' layer and occasionally a 'CMYK TOP' layer.
Is it possible to create a script that locks layers with specific names? All our documents have a 'CMYK' layer and occasionally a 'CMYK TOP' layer.
Hello @Davis_XI,
you can try either of these variations...
doc = app.documents[0];
try{for (var i = 0; i < doc.layers.length; i++){
if (doc.layers[i].name == "CMYK" || doc.layers[i].name == "CMYK TOP"){
doc.layers[i].locked = true;
}
} }catch(e){}
try{app.activeDocument.layers.item("CMYK").locked = true; app.activeDocument.layers.item("CMYK TOP").locked = true;}catch(e){}
Regards,
Mike
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.