5 Replies Latest reply: Nov 18, 2012 12:06 PM by léonie
Frank Butter Level 1 Level 1 (10 points)

Hello,

 

I'm looking for a way in AppleScript to find an Aperture image working copy object by it's name or filename. Most samples I found get the image objects by a selection, but I want to parse an excel list row by row containing the image name as a first column and manipulate the image objects in Aperture using the other columns.

So basically I try to do something like this:

 

set imageName to "AnyImage_001"

set currentImage to get image version with properties {name: imageName}

 

I'm aware that the above isn't running like this... So my question: is it possible to use "get" to find an image (or a list of images) in an opened aperture library by one of it's properties?

 

Thanks,

Frank

  • 1. Re: Find an Aperture Image by one of it's properties using AppleScript
    léonie Level 9 Level 9 (51,645 points)

    So my question: is it possible to use "get" to find an image (or a list of images) in an opened aperture library by one of it's properties?

    I don't think you can retrieve it by the properties, you will have to search all images for an image with that property:

     

    For example: This snippet creates a list of all image versions  in the library and maps it to a list of all names of the images.

    In the innermost loop, where it says

             

    set n to get the name of item i of ims

     

    you could get any other property of the ith image version and check it, then return the image version:

     

    tell application "Aperture"

              set ims to every image version

              set names to {}

              if ims is {} then

                        error "no images"

              else

                        repeat with i from 1 to count of ims

      -- do something with the image, get its name

                                  set n to get the name of item i of ims

                                  set names to names & n

                        end repeat

              end if

    end tell

     

    Regards

    Léonie


  • 2. Re: Find an Aperture Image by one of it's properties using AppleScript
    Jacques Rioux Level 4 Level 4 (1,960 points)

    Hi,

     

     

    Frank Butter wrote:

     

    Hello,

     

    I'm looking for a way in AppleScript to find an Aperture image working copy object by it's name

    So basically I try to do something like this:

     

    set currentImage to get image version with properties {name: imageName}

     

    Yes, it's possible :

     

    set currentImage to first image version whose name is imageName
    
  • 3. Re: Find an Aperture Image by one of it's properties using AppleScript
    léonie Level 9 Level 9 (51,645 points)

    Great! That is certainly easier than mine!

  • 4. Re: Find an Aperture Image by one of it's properties using AppleScript
    Frank Butter Level 1 Level 1 (10 points)

    That is what I was looking for, thank you!

  • 5. Re: Find an Aperture Image by one of it's properties using AppleScript
    léonie Level 9 Level 9 (51,645 points)

    Thanks for the green "Solved" mark, Frank, but  I think you meant this to go to Jaques. The buttons sometimes develope a life of their own and mark random post. There seems to be a race hazard in the interface.

     

    You still have two "Helpful" buttons to show Jaques your gratitude, if you want.