Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

End up w. text list of Project names?

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

Posted on Jul 25, 2013 8:52 AM

Reply
Question marked as Best reply

Posted on Jul 25, 2013 9:37 AM

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

20 replies

Jul 25, 2013 10:22 AM in response to Frank Caggiano

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 😐 .

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 accessfileoutFile with write permission

set eof of fileIdto 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) tofileId

close accessfileId


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.

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 accessfileoutFile with write permission


set eof of fileIdto 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) tofileId


close accessfileId

end if

It defaults to projectNameList

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 accessfileoutFile with write permission


set eof of fileIdto 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) tofileId


close accessfileId

end if

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

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.

Jul 25, 2013 4:32 PM in response to Frank Caggiano

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. 😉

Jul 25, 2013 4:43 PM in response to léonie

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.)

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 accessfileoutFile with write permission


set eof of fileIdto 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) tofileId


close accessfileId

end if

Jul 25, 2013 7:36 PM in response to léonie

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 😝

right the script is putting a return (\r) between each project name with this line

set AppleScript's text item delimiters to return

rather then the Unix line ending newline (\n). You could convert the \r to \n using tr


Pandora:Desktop frank$ tr '\r' '\n' < source.txt > dest.txt

End up w. text list of Project names?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.