• 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 CS3 : translate selection problem - possibly units?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Photoshop CS3 : translate selection problem - possibly units?


  • Subject: Re: Photoshop CS3 : translate selection problem - possibly units?
  • From: "James Gretton" <email@hidden>
  • Date: Sun, 3 Aug 2008 18:03:35 +0100

To follow up, many hours later I seem to have found a way to fix the
problem. I am now even more unhappy though because either I'm
completely missing something or this is an AppleScript bug! If anyone
can explain why this might be fixing the issue I'd be very grateful!

The fix is to reset the resolution of the file:

tell application "Adobe Photoshop CS3"
    set currentDoc to current document
    set ruler units of settings to pixel units

    -- Reset the resolution --
    set res to resolution of currentDoc
    resize image currentDoc resolution res

    select currentDoc region {¬
        {0, 0}, ¬
        {0, 10}, ¬
        {10, 10}, ¬
        {10, 0} ¬
    }

    translate selection of currentDoc delta x 10

end tell

Now all seems to work fine. Does anyone have any idea why this is?

Thanks,

James

2008/8/3 James Gretton <email@hidden>:
> Hello all, I'm using AppleScript and Photoshop CS3 to perform some
> automated image editing tasks and learning AppleScript at the same
> time.
>
> My problem is with PhotoShops translate command. Below is a simplified script:
>
> tell application "Adobe Photoshop CS3"
>
>    set currentDoc to current document
>    set ruler units of settings to pixel units
>
>    select currentDoc region {¬
>        {0, 0}, ¬
>        {0, 10}, ¬
>        {10, 10}, ¬
>        {10, 0} ¬
>    }
>
>    translate selection of currentDoc delta x 10
>
> end tell
>
> Which should select a 10 x 10 square and move it 10 pixels to the
> right. The selection works fine, however it seems to then move the
> selected area right off the screen.
>
> To translate the selection a few pixels to the right, I can instead do:
>
>    translate selection of currentDoc delta x 1.0E-8
>
> Does anyone know what the unit of this 0.00000001 could be, and how I
> can instead ensure this translation is done in pixels?
>
> Many thanks,
>
> James
>
 _______________________________________________
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/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Photoshop CS3 : translate selection problem - possibly units?
      • From: Shane Stanley <email@hidden>
References: 
 >Photoshop CS3 : translate selection problem - possibly units? (From: "James Gretton" <email@hidden>)

  • Prev by Date: Re: Alias Files
  • Next by Date: Re: Alias Files
  • Previous by thread: Photoshop CS3 : translate selection problem - possibly units?
  • Next by thread: Re: Photoshop CS3 : translate selection problem - possibly units?
  • Index(es):
    • Date
    • Thread