Using a script to search and find the text in a photoshop file

Hello,
I am trying to search the live text on layers inside photoshop (.psd) files. On a local machine (apple) I can use spotlight and it will find the type on the layers. But using any other database like cumulus or filemaker will not when the image is stored or referenced, nor will spotlight work on our servers.

Is there any way for an applescript to collect (maybe extract the text on the photoshop layers) and use them in a search. Maybe have the text extract from the layers and then create a new record in a program like filemaker or excel, and then that could be used as our search option.

I’m just trying to find some way to search inside of a .psd file the type on the layers. So, maybe a script might do it???
Any thoughts would be greatly appreciated.

thanks!
barbara

Hi Barbara,

because there is no Spotlight in OS 9, you better post into the OS X forum :wink:

This code extracts the text from all text layers in the frontmost .psd (CS 3) document


tell application "Adobe Photoshop CS3"
	tell document 1
		set t to contents of text object of layers whose kind is text layer
	end tell
end tell
set {TID, text item delimiters} to {text item delimiters, return}
set t to t as text
set text item delimiters to TID
t

Hi Stefan,
I will post it there too…thanks…
In the meantime, I will play around with what you ahve provided me…
thanks!
barbara

HI Stefen,
OK, I posted it on the OSX area.
I did try what you gave me and it worked great…
I’m thinking, if I can find a way to get some info out of the metadata area, like a sku number and description, then maybe I can ultimately populate a database like filemaker with just those fields and have the applescript, make anew record and get the SKU numbner, file name and these text layers. That would be awesome…
Well, I have lots to figure out…thanks for the head start…
barbara

Hi Stefen,

Once I have the text in the results box, can I extract that text and move it into something else?
I just modified yours, with a ", " rather than a “return” … now I want to get access to that text outside of applescript…
thanks!
barbara