From what i gather it’s not that easy to return the bounds of a selection, however some dude on this link came up with this:
“That’s not something that is currently scriptable.
You can calculate the size of the current selection (by creating a new document with the contents and then getting the height/width of that), but you can’t get the selection points.”
From what I’ve seen elsewhere selection bounds was introduced not long ago either CS1 or 2 and has never worked as intended even in Java. Seems the easiest work around is to create new layer fill your selection get the bounds of the layer then throw it away. Here’s a snippet.
tell application "Adobe Photoshop CS"
activate
set docRef to the current document
tell docRef
tell path item 1
create selection feather amount 0 with antialiasing
end tell
set savedState to current history state of docRef
make new art layer at beginning of docRef with properties ¬
{name:"Selection Bounds", blend mode:normal}
set current layer to layer "Selection Bounds" of docRef
fill selection with contents {class:RGB color, red:255, green:255, blue:255}
set thebounds to bounds of layer "Selection Bounds"
set current history state of docRef to savedState
end tell
end tell
Having just dug out a copy of PS7, Mark, I can confirm that the selection property bounds is not available there. The same goes for container and default type.
tell application "Adobe Photoshop 7.0" to properties of selection of current document
--> {class:selection-object, best type:reference}