Is there a way of selecting text on an illustration and finding the centre of the text in a macro?
I can only find what seems to be the lower left load point (.text.startpoint), but I want to mirror text about it's centre.
Solved! Go to Solution.
Haven't done this on a single element, my method was for the contents of a page, but you should be able to make use of some of it. Below is a snippet from that code. The main idea is that you have to apply object_info in order to get points of an object. With the snippet below you'll get all four points, you can then use basic math to determine center.
Define Final_Top as Float
Define Final_Bottom as Float
Define Final_Right as Float
Define Final_Left as Float
Create object_info ActiveDoc.firstSelectedElement
ActiveDoc.firstSelectedElement.info.view_context.type = "extent"
Compare_Left = ActiveDoc.firstSelectedElement.info.view_context.rectangle.left
Compare_Right = ActiveDoc.firstSelectedElement.info.view_context.rectangle.right
Compare_Top = ActiveDoc.firstSelectedElement.info.view_context.rectangle.top
Compare_Bottom = ActiveDoc.firstSelectedElement.info.view_context.rectangle.bottom
Haven't done this on a single element, my method was for the contents of a page, but you should be able to make use of some of it. Below is a snippet from that code. The main idea is that you have to apply object_info in order to get points of an object. With the snippet below you'll get all four points, you can then use basic math to determine center.
Define Final_Top as Float
Define Final_Bottom as Float
Define Final_Right as Float
Define Final_Left as Float
Create object_info ActiveDoc.firstSelectedElement
ActiveDoc.firstSelectedElement.info.view_context.type = "extent"
Compare_Left = ActiveDoc.firstSelectedElement.info.view_context.rectangle.left
Compare_Right = ActiveDoc.firstSelectedElement.info.view_context.rectangle.right
Compare_Top = ActiveDoc.firstSelectedElement.info.view_context.rectangle.top
Compare_Bottom = ActiveDoc.firstSelectedElement.info.view_context.rectangle.bottom
Wow that was quick, thanks Trevor, I'll check it out early next week, looks promising.