Opening files of a type in PS

Ok!!! Now I’m trying to open every item that I was able to load. The problem is that Photoshop will not let open those selected files. I tried get and select command with no success. I’m thinking that there should be a command inbetween the Finder tell statement and the Photoshop tell statement but what? Here is my code thus far:

property theFileTypes : {“…CT”, “8BPS”, "BMP ", “BMPf”, “EPSF”, “EPSP”, “GIFf”, “JPEG”, "PCX ", “PCXx”, “PICT”, “PNGf”, “PNTG”, "SGI ", “TIFF”, “TPIC”}
tell application “Finder”
activate
set theFileListFolder to choose folder with prompt “Choose a folder with images.”
set theFileList to get every file of entire contents of theFileListFolder whose file type is in theFileTypes
end tell

tell application “Adobe Photoshop CS”
open every item in the theFileList
end tell

Since the first part of the code works fine (identifying the relevant files), the problem has to be in the Photoshop CS part.

Looking at the code you tell Photoshop CS to:

open every item in theFileList.

specifying ‘every item’ of a list is the same as specifying the list itself, so this line can also be written as:

open theFileList

In that case, the only problem I can think of (I don’t have Photoshop CS to test with) is that PhotoShop wants specific files, not a list. If that’s the case, change the Photoshop CS code to:

repeat with eachFile in theFileList
open eachFile
end repeat

You might also need to coerce the item to an alias rather than as a File object (which is inherent to the Finder), so:

open alias eachFile

might also work.

ok, if I use this code:

tell application “Adobe Photoshop CS”
repeat with eachFile in theFileList
open eachFile
end repeat
end tell

Error message is:
Finder got an error: item 1 of {document file “Poster2 Rev.jpg” of folder “Image files” of folder “Utilities” of startup disk, document file “PS Test.eps” of folder “Image files” of folder “Utilities” of startup disk} doesn’t understand the open message.

If I use this code:

tell application “Adobe Photoshop CS”
repeat with eachFile in theFileList
open alias eachFile
end repeat
end tell

I get this Error message:

Can’t make «class docf» “Poster2 Rev.jpg” of «class cfol» “Image files” of «class cfol» “Utilities” of «class sdsk» of application “Finder” into the expected type.

Ohhhh I was looking at the Finder Dictionary and under open there are some options.Problem is the word “using” I get an error I’m not sure how to word my statement.

property theFileTypes : {“…CT”, “8BPS”, "BMP ", “BMPf”, “EPSF”, “EPSP”, “GIFf”, “JPEG”, "PCX ", “PCXx”, “PICT”, “PNGf”, “PNTG”, "SGI ", “TIFF”, “TPIC”}
tell application “Finder”
activate
set theFileListFolder to choose folder with prompt “Choose a folder with images.”
set theFileList to get every file of entire contents of theFileListFolder whose file type is in theFileTypes
end tell

open every item in the theFileList using “Adobe Photoshop CS”

Maybe this will work if you modify it to reflect the correct path to Photoshop (line -2):

property theFileTypes : {"..CT", "8BPS", "BMP ", "BMPf", "EPSF", "EPSP", "GIFf", "JPEG", "PCX ", "PCXx", "PICT", "PNGf", "PNTG", "SGI ", "TIFF", "TPIC"}
tell application "Finder"
	activate
	set theFileListFolder to choose folder with prompt "Choose a folder with images."
	set theFileList to get every file of entire contents of theFileListFolder whose file type is in theFileTypes
	open every item in the theFileList using "path:to:Adobe Photoshop CS"
end tell

– Rob

don’t know if they fixed it in panther, but filter references don’t work with the ‘contained by’ operator with the Finder in OSX.

It is, indeed, fixed in 10.3