• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Photoshop selection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Photoshop selection / pixel colors
      • From: "Fleisher, Ken" <email@hidden>
References: 
 >Photoshop selection (From: "Fleisher, Ken" <email@hidden>)

  • Prev by Date: Photoshop selection
  • Next by Date: Re: Photoshop selection / pixel colors
  • Previous by thread: Photoshop selection
  • Next by thread: Re: Photoshop selection / pixel colors
  • Index(es):
    • Date
    • Thread