Skip to main content
Flowgun
Inspiring
Dec 10, 2025 5:25 PM UTC
Question

move shapes into an opacity mask via scripting?

Hello,
I'm trying to write a script that gets the silhouettes of shapes on the current layer, then create a new layer that has an opacity mask revealing just those silhouette shapes so that we can only draw within those shapes on the new layer.
It is possible to create an opacity mask via actions, which can be scripted, but I didn't find a way to paste or move the shapes into the opacity mask.
Is that possible via scripting?

4 replies

Legend
Dec 11, 2025 12:11 AM UTC

Can this be achieved using a layer clipping mask instead of an opacity mask? If it's a silhouette, it can be done with a simple path, correct?

Translate
Flowgun
FlowgunAuthor
Inspiring
Dec 11, 2025 12:22 AM UTC

yes but I wanted to explore opacity masks as they can be attached to a whole layer, allowing me to paint or create shapes on that layer freely. plus the eraser tool doesn't work on clipping masks.

Translate
m1b
Community Expert
Community Expert
Dec 11, 2025 2:57 AM UTC

Yes I would like that, too, but unfortunately many functions of Illustrator are not exposed via the scripting API, including, sady, opacity masks. If there is a way to do what you want, I think it will be a creative hack of some sort.

Translate