I frequently create labels that follow the same format: white text on a 75% opaque black background, with 10px of margin around the text. Currently, I have to manually build these labels, which takes a lot of work.
In one method, I write the text, figure out its height and width, then create a separate rectangle and place it behind it. This takes a lot of clicking around for every label.
In the other method, I draw out a text box, select it directly, give it the correct background and margins, and then insert the text. However, I must then resize the box manually, meaning more clicking around and greater imprecision. There doesn't seem to be a way to directly select a text box once it has text inside it.
I tried using the script contained in a related answer to resize the text box to the content, but it only resizes the box vertically, and removes my color and margins.
Does anyone have suggestions on how to resolve these problems, or for a better method? I'm using CS3.
You really don't need any scripting for this.
<Characters>item in the Appearance Panel
Effect > Convert to Shape > Rectangle
The background rectangle is relative to the size of the text object. Should the text object change in size the rectangle adjusts to match.
When you need to reapply the appearance, select the text object and click the Graphic Style.
If you find you are having difficulty with text colors being incorrect after applying the Graphic Style, please see @BANG's solution HERE.