Horizontal Rule over Text Frame

Here is a simple script whose idea is to create a horizontal line over a text frame, much the way you might create a horizontal rule. The only value you enter is the width of the line as a percentage of the width of the text frame.

As written, it requires a text frame, but could be modified to use with some other object. The line is placed in a centered position over the frame, centered both horizontally and vertically. The presumption would be that you would then adjust the Y-Pos of the line as needed. The default line width is set at 1.0 points.

Other notes
One might consider modifications for use in frames with columns, though what you might do in that situation is use the InfoBox script, then create the line over the InfoBox frame by selecting it. Something else to think about is that, once you get your line situated, you may want to group the frame and line(s) so that you don't accidentally move them.

Here is a hint on centering the line vertically between two lines of text. Roughly place the line, then increase its width to about the size of the space between the text above and below, then more precisely center it to your satisfaction. Reduce the line width to where you want it to be, and you should find it very well centered.

I also tried creating a line, then sending to Inline items, then inserting into the text of a frame. This is doable, and easy enough to manage centering horizontally by selecting center justification, but what is trickier is the vertical adjustment in the line, and you also lose the ability to adjust properties of the line.