Skip navigation

End up w. text list of Project names?

1962 Views 20 Replies Latest reply: Jul 30, 2013 9:32 AM by Kirby Krieger RSS
1 2 Previous Next
Kirby Krieger Level 6 Level 6 (11,550 points)
Currently Being Moderated
Jul 25, 2013 8:56 AM

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
  • Frank Caggiano Level 7 Level 7 (22,745 points)
    Currently Being Moderated
    Jul 25, 2013 9:37 AM (in response to Kirby Krieger)

    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

  • Frank Caggiano Level 7 Level 7 (22,745 points)
    Currently Being Moderated
    Jul 25, 2013 9:56 AM (in response to Kirby Krieger)

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

  • Frank Caggiano Level 7 Level 7 (22,745 points)
    Currently Being Moderated
    Jul 25, 2013 10:26 AM (in response to Kirby Krieger)

    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.

  • Frank Caggiano Level 7 Level 7 (22,745 points)
    Currently Being Moderated
    Jul 25, 2013 10:42 AM (in response to Kirby Krieger)

    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

  • Frank Caggiano Level 7 Level 7 (22,745 points)
    Currently Being Moderated
    Jul 25, 2013 10:51 AM (in response to Kirby Krieger)

    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.

  • léonie Level 8 Level 8 (46,350 points)
    Currently Being Moderated
    Jul 25, 2013 11:00 AM (in response to Frank Caggiano)

    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.

  • Frank Caggiano Level 7 Level 7 (22,745 points)
    Currently Being Moderated
    Jul 25, 2013 11:05 AM (in response to léonie)

    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.

  • léonie Level 8 Level 8 (46,350 points)
    Currently Being Moderated
    Jul 25, 2013 11:42 AM (in response to Frank Caggiano)
    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

  • léonie Level 8 Level 8 (46,350 points)
    Currently Being Moderated
    Jul 25, 2013 4:49 PM (in response to Kirby Krieger)

    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 

  • Frank Caggiano Level 7 Level 7 (22,745 points)
    Currently Being Moderated
    Jul 25, 2013 7:16 PM (in response to Kirby Krieger)

    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

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.