Two scripts for Adobe Illustrator that create rectangles around selected objects. Both scripts work correctly with clipping group dimensions.
AddRectangleAroundObject
Creates rectangles based on the size of the object's bounding box plus the margins. Values are enumerated using commas, and a period is used to indicate fractions. The order is left, top, right, bottom.
AddSquareAroundObject
This script adds squares behind objects. The size of the square is calculated from the larger side of the object plus the margins. The value of the margins is converted to document units.