The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle General (http://forums.omnigroup.com/forumdisplay.php?f=10)
-   -   applescript to put text to the left of a point? (http://forums.omnigroup.com/showthread.php?t=28544)

gshenaut 2013-03-02 08:31 PM

applescript to put text to the left of a point?
 
What is the applescript to align the right side of a text immediately to the left of a certain point? Here is what I'm using:[CODE]make new shape at front of graphics with properties {side padding: 0, fill: no fill, draws stroke: false, draws shadow: false, autosizing: clip, size: {20, 10}, text: {text: "***", size: 14, alignment: right, font: "Helvetica", text: "***"}, origin: {5.85714285714285714, -51}, vertical padding: 0}[/CODE]This aligns the text correctly in some cases, but if I change the overall scaling, the text drifts to the right or to the left of the alignment point. What I need is a positive way to stick the rightmost character of the text a certain distance to the left of a certain point. I speculate that my problem is related to the “size: {20, 10}”, which establishes the width of the text box (independent of the actual width of the text). However, if I leave this out, I get no text at all (perhaps it defaults to 0,0). I think that what is happening is that as my scale changes, the width of the text box changes, but the text size (determined by the pointsize) does not; this inconsistency causes the drift. If this is correct, then if I had a way to go from a certain text string (and font and pointsize) to the exact width of the text block in points, then the rightmost character of the text would always be in the same relation to the right side of the text box, and so it would also be in the right place relative to the point I want to align it to.

Any suggestions?

UPDATE: OK, I'm having a bit better luck using “autosizing:full” and “size:{1, 1}”. This makes the text rectangle fit the text correctly. But I'm still having a problem placing the R.H. side of the text to the left of a certain point.

UPDATE 2: Well, I've worked around the problem by space-padding my text labels and using Menlo-Regular (monospaced) as the font, then just setting the origin of the text a known difference to the left of the reference point. But I'd still like to know the right way to do this, if there is one. Something akin to origin:{x, y} but where “origin” could be (e.g.) N, NE, E, SE, S, SW, W, NW, or C, instead of being limited to just NW as it is now.


All times are GMT -8. The time now is 04:27 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.