Skip to main content
Flowgun
Inspiring
December 10, 2025
Question

move shapes into an opacity mask via scripting?

  • December 10, 2025
  • 1 reply
  • 188 views

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?

1 reply

Legend
December 11, 2025

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?

Flowgun
FlowgunAuthor
Inspiring
December 11, 2025

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.

m1b
Community Expert
Community Expert
December 11, 2025

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.