1 2 Previous Next 20 Replies Latest reply: Jul 30, 2013 9:32 AM by Kirby Krieger
Kirby Krieger Level 6 Level 6 (11,945 points)

Hi.  Is there any tool available that takes an Aperture Library and produces a text list of Project names?

 

Currently looking at Automator -- sad to report, for me this is not much different than looking into a goldfish pond: I see shiny things, but they are unclear and out-of-reach  .

 

Thanks.

 

--Kirby.

 

Message was edited by: Kirby Krieger -- "text" list.


MacBook Pro (Retina, Mid 2012), OS X Mountain Lion, 16 GB RAM; 500 GB SSD; NEC; Munki
  • 1. Re: End up w. text list of Project names?
    Frank Caggiano Level 7 Level 7 (23,865 points)

    Automator won't do it, it will need to be done with an AppleScript.

     

    If no one gets to it sooner I should be able to get you something later today.

     

    Regards

  • 2. Re: End up w. text list of Project names?
    Frank Caggiano Level 7 Level 7 (23,865 points)

    BTW what do you want to do with the text list? Write to a file, put in clipboard, ??

  • 3. Re: End up w. text list of Project names?
    Kirby Krieger Level 6 Level 6 (11,945 points)

    Thanks Frank.  Text file.  Want to have text files listing Project names available on system drive to search when the Library is unavailable (e.g.: on an external drive that is not mounted).

     

    Unsurprisingly, I got nowhere with Automator, beyond finding out that some of the Aperture actions are deprecated and no longer usable  .

  • 4. Re: End up w. text list of Project names?
    Frank Caggiano Level 7 Level 7 (23,865 points)

    Actually had one pretty much all ready wriiten, so this

     

    set outFile to (path to desktop as text) & "projectNameList.txt"

    set fileId to open for access file outFile with write permission

    set eof of fileId to 0

     

    tell application "Aperture"

      activate

              set projectList to name of every project

    end tell

     

    set AppleScript's text item delimiters to return

    write (projectList as string) to fileId

    close access fileId

     

    Will give you a text list of all your projects one per line in a text file on the Desktop called projectNameList.txt. The text file will be overwritten each time you run this so if you need to keep an old one around rename it. The scipt could be changed to append to the file.

     

    Really bare bones here, no error checks or other good stuff.

     

    Let me know how it works for you.

  • 5. Re: End up w. text list of Project names?
    Frank Caggiano Level 7 Level 7 (23,865 points)

    This one will prompt for the file name but still place it on the Desktop. Just give it the filename not extension it will always make it .txt

     

    set userCanceled to false

    try

              set dialogResult to display dialog ¬

                        "Name of text file?" buttons {"Cancel", "OK"} ¬

      default button "OK" cancel button ¬

                        "Cancel" default answer ("projectNameList")

    on error number -128

              set userCanceled to true

    end try

     

    if not userCanceled then

              set outFile to (path to desktop as text) & text returned of dialogResult & ".txt"

              set fileId to open for access file outFile with write permission

      set eof of fileId to 0

     

     

              tell application "Aperture"

      activate

                        set projectList to name of every project

              end tell

     

              set AppleScript's text item delimiters to return

      write (projectList as string) to fileId

      close access fileId

    end if

    It defaults to projectNameList

  • 6. Re: End up w. text list of Project names?
    Frank Caggiano Level 7 Level 7 (23,865 points)

    OK final change

     

    tell application "Aperture"

              set LibraryName to name of every library

    end tell

     

     

    set userCanceled to false

    try

              set dialogResult to display dialog ¬

                        "Name of text file?" buttons {"Cancel", "OK"} ¬

      default button "OK" cancel button ¬

                        "Cancel" default answer (LibraryName)

    on error number -128

              set userCanceled to true

    end try

     

    if not userCanceled then

              set outFile to (path to desktop as text) & text returned of dialogResult & ".txt"

              set fileId to open for access file outFile with write permission

      set eof of fileId to 0

     

     

              tell application "Aperture"

                        set projectList to name of every project

              end tell

     

              set AppleScript's text item delimiters to return

      write (projectList as string) to fileId

      close access fileId

    end if

    This gets the name of the library and sets the default name of the text file to the library.

  • 7. Re: End up w. text list of Project names?
    léonie Level 9 Level 9 (51,775 points)

    Wow, that script is quick!

     

    At first, I thought, there was a bug, when I did not see it run. But it finished in the blink of an eye!

     

    And the list seems to be ordered exactly as the sequences of folders in the library inspector.

  • 8. Re: End up w. text list of Project names?
    Frank Caggiano Level 7 Level 7 (23,865 points)

    How many projects in the library you tried?

     

    Somethings AS can do quick. In both cases (getting the list of project names and writing them out) it is dealing with the list as single entity, its not needing to intenerate through it so it should be pretty quick.

     

    If you had to go through each project name one at a time in a loop it could get really slow on a large library.

  • 9. Re: End up w. text list of Project names?
    léonie Level 9 Level 9 (51,775 points)
    How many projects in the library you tried?

     

    Roughly 500 projects.

     

    I tried to count exacly, but "wc -l" from the Terminal did not work. There do not seem to be <newline> characters in the textfile, so I had to count the words

  • 10. Re: End up w. text list of Project names?
    Kirby Krieger Level 6 Level 6 (11,945 points)

    Hi Frank -- many thanks!  Varied results: a "Wow!" and a "".

     

    Ran your script from the AppleScript Editor on a Library with 1,240 Projects.  Text file listing Projects appeared instantly ( <1s; too fast to time by hand).  Wow!

     

    Closed Aperture, reopened with a larger Library, closed Aperture.  (This was to make the larger Library the "current" Library -- needed, I think, since the script defaults to the most recently loaded Library (afaict).)  Got the following result:

    error "Aperture got an error: AppleEvent timed out." number -1712

    There are >20,000 Projects in the larger Library.  .  Await your sage advice. 

  • 11. Re: End up w. text list of Project names?
    Kirby Krieger Level 6 Level 6 (11,945 points)

    leonieDF wrote:

     

    How many projects in the library you tried?

     

    Roughly 500 projects.

     

    I tried to count exacly, but "wc -l" from the Terminal did not work. There do not seem to be <newline> characters in the textfile, so I had to count the words

     

    Um ... In Text Edit, you can convert to RTF, select all, and then "Format➞List ... ".  Or paste into a spreadsheet.  Or paste into a Pages document, and go to the "Info" tab of the Document Inspector.  Or ... see what Aperture shows on the bottom border of the Projects View.

     

    .

     

    (Maybe I missed something ... been a long (productive) day.)

  • 12. Re: End up w. text list of Project names?
    léonie Level 9 Level 9 (51,775 points)

    My unfortunate Unix training, KIrby.

     

    When I want to know the number of lines in a textfile, I use the Terminal!

     

    And being distracted by the riddle of the end-of-line encoding, I completely forgot, that my main objective was to count projects and not lines 

  • 13. Re: End up w. text list of Project names?
    Kirby Krieger Level 6 Level 6 (11,945 points)

    As one who not only misses the forest for the trees, but just as often missed the trees for the bark, I understand.  Mostly, I wish I knew Unix.  .

  • 14. Re: End up w. text list of Project names?
    Frank Caggiano Level 7 Level 7 (23,865 points)

    Kirby Krieger wrote:

     

    Hi Frank -- many thanks!  Varied results: a "Wow!" and a "".

    Thanks

     

    Closed Aperture, reopened with a larger Library, closed Aperture.  (This was to make the larger Library the "current" Library -- needed, I think, since the script defaults to the most recently loaded Library (afaict).) 

    Yes the scripts uses the last opened or currently opened library. It's the same as when you run Aperture, the last opened library is the one that is used.

     

    If you switch libraries you can leave Aperture opened there is no need for it to be closed befroe the script runs. In fact once you have Aperture open you can use File->Switch to Library to switch libraries and then run the script.

     

    Got the following result:

    error "Aperture got an error: AppleEvent timed out." number -1712

    There are >20,000 Projects in the larger Library.  .  Await your sage advice. 

    Hmm, > 20,000 projects is a lot but I wouldn't have expected this.

     

    The following modified script will increase the wait time from 2 mins to 10 mins if this is where the error is that should be more then enough time. let me know how this one works.

     

    tell application "Aperture"

              set LibraryName to name of every library

    end tell

     

     

    set userCanceled to false

    try

              set dialogResult to display dialog ¬

                        "Name of text file?" buttons {"Cancel", "OK"} ¬

      default button "OK" cancel button ¬

                        "Cancel" default answer (LibraryName)

    on error number -128

              set userCanceled to true

    end try

     

    if not userCanceled then

              set outFile to (path to desktop as text) & text returned of dialogResult & ".txt"

              set fileId to open for access file outFile with write permission

      set eof of fileId to 0

     

     

              tell application "Aperture"

                        with timeout of 600 seconds -- 10 minutes

                                  set projectList to name of every project

                        end timeout

              end tell

     

              set AppleScript's text item delimiters to return

      write (projectList as string) to fileId

      close access fileId

    end if


1 2 Previous Next