Hi I need some help creating a simple script

With an object selected could be text path or random shape vector path etc

Run script that will draw a rectangle box around the selected item

leaving a 3pixel gap all the way around.

Its to speed up my workflow I have to draw alot of rectangles that are tight fitted to selected objects often!

Is this possible.