Skip to main content
Participant
September 22, 2026
Question

How to check if TextFrame is being used as a mask in the clipping group

Hey everyone! I need to check which pageItem inside the clip group is used as a mask, I’m right now stuck on TextFrame since it doesn’t expose the clipping property

5 replies

CarlosCanto
Community Expert
Community Expert
September 25, 2026

I thought of something else, 

 

check for textItem fillColor and strokeColor, both should be [NoColor] if they’re the clipping path

Translate
CarlosCanto
Community Expert
Community Expert
September 25, 2026

you may have to cycle through all pathItems and compoundPathItems, check for clipping property and if there’s none, then you would assume the clipping path is a textItem, hopping there’s only one

Translate
CORCTON34033231
Community Expert
Community Expert
September 25, 2026

Good catch — yes, that's possible. The snippet relies on Illustrator's guarantee that the mask is the topmost object at the moment the clipping mask is created (Illustrator moves it there automatically). Once you manually reorder the group's contents, that assumption no longer holds. If you're reordering via script, keep your own reference to the mask object before moving it. And in the Layers panel, the mask is always the item labeled “<Clipping Path>” — that's the reliable visual check regardless of order.

Translate
CORCTON34033231
Community Expert
Community Expert
September 22, 2026

You're right that TextFrame doesn't expose a clipping property — only PathItem and CompoundPathItem do.

 

The reliable way is to check the group itself: a clip group has its clipped property set to true, and the clipping mask is always the topmost object in the group (Adobe Help: "The first object in a layer or group becomes the clipping mask"). Since Illustrator orders pageItems from back to front, the mask is the last item:

 

var g = app.activeDocument.groupItems.getByName("your group");

if (g.clipped) {

    var maskItem = g.pageItems[g.pageItems.length - 1];

    if (maskItem.typename === "TextFrame") {

        // this TextFrame is the clipping mask

    }

}

 

This works for any pageItem type used as a mask — TextFrame included — because you identify it by its position in the group rather than a type-specific property.

 

Reference: https://helpx.adobe.com/illustrator/desktop/manage-objects/edit-objects/about-clipping-masks.html

Translate
Participant
September 24, 2026

Hi, is this possible that first pageItem is not the mask? I tried the script after moving the mask down in the order and script reported first item which was not the mask.

Translate