Results 1 to 4 of 4

Thread: Selecting in photoshop using python doesn't work

  1. #1

    Default Selecting in photoshop using python doesn't work



    From the link in the python+photoshop thread, someone left a commented with this same question and ended up posting that the solution had something to do with comtypes ( http://sourceforge.net/projects/comtypes/ ). There were no specifics on how to use this module to get it working however so I thought I'd post here.
    Does anyone know?

  2. #2
    while loop Eric Chadwick's Avatar
    Join Date
    Jul 2008
    Location
    Boston USA
    Posts
    172

    Default

    Might be some info here.
    http://www.ps-scripts.com/bb/

  3. #3
    Administrator Adam Pletcher's Avatar
    Join Date
    Jun 2008
    Location
    Champaign, IL
    Posts
    265

    Default

    Here's an example. If you've installed comtypes from the Sourceforge page, it should just work.

    Code:
    import comtypes.client
    ps_app = comtypes.client.CreateObject('Photoshop.Application')
    # makes a new 128x128 image
    ps_app.Documents.Add(128, 128, 72)
     
    # select 10x10 pixels in the upper left corner
    sel_area = ((0, 0), (10, 0), (10, 10), (0, 10), (0, 0))
    ps_app.ActiveDocument.Selection.Select(sel_area)
    Adam Pletcher
    Volition Studio Architect, Technical Art
    blog: Tech Art Tiki

  4. #4

    Default

    ahhh thanks for that. I was still using the win32com module and thinking that I needed to cast my array to something using comtypes. I guess it's a replacement for win32com then. Thanks again

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •