Re: Photoshop measure tool
Re: Photoshop measure tool
- Subject: Re: Photoshop measure tool
- From: Stan Cleveland <email@hidden>
- Date: Wed, 15 Nov 2006 10:53:08 -0800
- Thread-topic: Photoshop measure tool
Title: Re: Photoshop measure tool
On 11/15/06 4:29 AM, Fleisher, Ken wrote:
> Yes, a simple path will probably work great! Thanks for the suggestion.
> (Though I'm an AppleScript veteran, I've only begun scripting Photoshop this
> week...)
>
> Next question: I've tried it with a path and in a document that is 5x5
> inches at 300 dpi (1500x1500 pixels), I placed one point at x = y = 1 inch
> to get a handle on the units. It seems that the units are in points (72
> points per inch). Is that correct? Is there any way to get the coordinates
> in cm or inches without needing to convert myself?
Yes:
tell application "Adobe Photoshop CS2"
set ruler units of settings to inch units
end tell
> If it is in points, is it 72 points/inch or 72.27 points/inch (as in correct
> Postscript)?
Your choice:
tell application "Adobe Photoshop CS2"
set point size of settings to postscript size -- 72/inch
set point size of settings to traditional size -- 72.27/inch
end tell
> I've also just noticed that my screen resolution is set to 72 pixels/inch.
> Please tell me that the coordinates are not based on the screen resolution!
They are NOT based on screen res, but rather on Photoshop settings, as above.
>> the corners of a rectangular selection (which you can get from its bounds)
> What would this?:
>
> properties of selection
>
>>> {bounds:missing value, ...
>
> How would I get the bounds of a selection if it reports missing?
Oops! That’s my mistake. It appears that you can’t get the bounds of a selection, despite the fact that it’s in the properties list. Here’s an alternate approach that makes a temporary layer from a rectangular selection and gets the bounds of that layer (something that IS possible).
tell application "Adobe Photoshop CS2"
set foreColor to foreground color
tell current document
try — non-destructive test that selection exists
translate boundary selection delta x 0
on error number 8152 -- there is no selection
return {0, 0, 0, 0} -- or whatever
end try
-- make temporary layer and get its bounds
set tempLayer to make new art layer
fill selection with contents foreColor
set {t, l, b, r} to bounds of tempLayer
delete tempLayer
return {t, l, b, r} -- top, left, bottom, right of selection in inches
end tell
end tell
Stan C.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden