how do you get every image in resource path of main bundle?

Hi everyone…

I have tried:

set image_list to every image in (resource path of main bundle)

and I have tried:

set image_list to every file in (resource path of main bundle) whose name extension is "jpg" 

neither of these are working…

any ideas?

thank you in advance.
-patrick

You could try this. I haven’t tested it yet, but I think it should work.

set images_path to POSIX path of (path to me as string) & "Contents/Resources/"
try
	set image_list to do shell script "ls " & images_path & "*.jpg"
on error
	set image_list to {}
end try

Thanks for the reply…

problem is, that seems to return one big string of files inside a list…

like {“1.jpg\n2.jpg\n3.jpg”}

rather than {“1.jpg”,“2.jpg”,“3.jpg”} like I need it to…

-patrick

Try breaking up those lines:

do shell script "/bin/ls " & images_path & "*.jpg"
set image_list to paragraphs of result

Thank you very much!

-patrick