The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
applescript to put text to the left of a point? Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
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}
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.

Last edited by gshenaut; 2013-03-03 at 04:26 PM..
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to center text in applescript efuchs OmniGraffle General 4 2012-04-13 09:05 AM
"No current point for control point bounds" robertjlamb OmniGraffle General 1 2011-07-20 11:26 AM
questions on point list in AppleScript roosterboy AppleScripting Omni Apps 0 2010-07-18 05:32 PM
Text not flush left Manticore OmniOutliner 3 for Mac 2 2006-06-12 07:29 AM
applescript: text snippets steve OmniOutliner 3 for Mac 2 2006-05-19 10:10 AM


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


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