Indesign CS - position of a character from its paragraph's edge

Hello all

Currently I have a script which is estimating where to insert a tab in a line based on how many characters precede my search character (where the search character is the character that is to follow the tab if it is required). This works to a degree but screws up for a large number of instances where the characters preceding my search character are very wide or very thin (eg. "W’’ vs "I"s).

To fix this I figure it would be best to identify the exact position of where my search character is and compare it to the tab stops in the paragraph that contains it. My problem is where or how do I find that position. Does anyone know if there is a property that identifies the position of a character (in inches, picas, points, etc.) as measured from the left edge of the paragraph that contains it? If there is no such property, could someone offer a suggest on how I might go about calculating it’s position?

Thanks in advance for any help or suggestions you have to offer.

Len

The physical location of a character is held in a few properties. For it’s location on the x axis you want the horizontal offset of the character which is calculated based of off the rule origin of the page. You need to do a little math to get the distance it is from the edge of the text box, something like d1 - d2 = d3 where d1 is the horizontal offset of the character d2 is the x origin of the text box and d3 is the distance from the edge of the text box to the left edge of the character.

ah… I see. OK, that gives me a good idea of how to proceed. Thanks again Jerome.