All presets

Auto Box

Makes a box that fits any layer in an instant, handy for subtitles and alpha mattes.

Tutorial, 0:55

Apply it to a shape layer and drag that layer below the one you want boxed: by default the box fits itself to the layer above and follows it. Extra Size pads the box, Rectangle gives it rounded corners, and Line turns it into a line you can trim. If the text is animated, change Anchor at Time so the box measures the right frame.

Install it under User Presets, then Shapes, and refresh the Effects and Presets panel.