Copy link to clipboard
Copied
I want to set "Make/Release Clipping Mask" from the Layers flyout menu on a specific layer [0]. I've created an action that will toggle "Make/Release Clipping Mask" on and off, but for it to work at the "layer" level the layer must be highlighted in the layers panel. How can I do that in Javascript?
The artwork does not need to be selected, but for the top shape to mask the entire layer the layer must be highlighted, as you see above. If selected, this simple Action, run through Javascript, will do the trick:
Thanks for any helps.
Hi @rcraighead, in your script can you try
app.activeDocument.activeLayer = myLayer;
where myLayer is a reference to your layer?
- Mark
Not sure if this relevant to your situation, but creating and releasing a clipping mask can be done with one line of code. A clipping mask is just a group with the "clipped" perperty set to true.
// select group
app.selection[0].clipped = true;
Copy link to clipboard
Copied
Hi @rcraighead, in your script can you try
app.activeDocument.activeLayer = myLayer;
where myLayer is a reference to your layer?
- Mark
Copy link to clipboard
Copied
Not sure if this relevant to your situation, but creating and releasing a clipping mask can be done with one line of code. A clipping mask is just a group with the "clipped" perperty set to true.
// select group
app.selection[0].clipped = true;
Copy link to clipboard
Copied
Thank you both for you help.
"activeLayer" works only if I select and deselect artwork on a different layer first. Otherwise, the target layer does not get highlighted and "Make Clipping Mask" fails.