Opening image and copying it to resource folder

I’m making a personal application where I select an image and it will be copied into the resource folder of the application for later use.
I have the choose file part set up and can load the image into the image view from there, but how would I go about making a copy into the resource folder of the application?

set theFile to choose file with prompt "Choose the image" of type openTypes
		set the contents of text field "picpath" of window "with" to theFile
		set theimage to theFile
		set the image of image view "image" of window "with" to load image theimage

Model: eMac G4
Browser: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.11) Gecko/20071128 Camino/1.5.4
Operating System: Mac OS X (10.3.9)

Hi HarryCaray,

You could use code as follows to silently copy the image to the resource folder of your application. Please note, that the code does not check, if a file with the same file name already exists in the resource folder:


set theFile to choose file with prompt "Choose the image" --of type openTypes
-- resoure folder path (Posix)
set resfolderpath to POSIX path of (((path to me) as Unicode text) & "Contents:Resources:")
-- image file path (Posix)
set imgpath to POSIX path of (theFile as Unicode text)
-- copy command
set command to "cp " & quoted form of imgpath & " " & quoted form of resfolderpath
-- copying
do shell script command

Worked perfectly, thank you Martin!