Re: Photoshop selection
Re: Photoshop selection
- Subject: Re: Photoshop selection
- From: Stan Cleveland <email@hidden>
- Date: Wed, 20 Dec 2006 11:45:18 -0800
- Thread-topic: Photoshop selection
Title: Re: Photoshop selection
On 12/20/06 11:24 AM, Fleisher, Ken wrote:
Does anyone know how to get the bounds of a selection in Photoshop??
tell application "Adobe Photoshop CS2"
tell current document
properties of selection
end tell
end tell
--> {bounds:missing value, container:document "ColorChecker_ProPhoto_from_Lab_D50.tif" of application "Adobe Photoshop CS2", best type:reference, default type:reference, class:selection-object}
Why is the value of bounds a missing value?
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 selection, gets the bounds of that layer, then deletes it.
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
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