on clicked theObject
if name of theObject is "getpic" then
set Choice to "Macintosh HD:Users:steve:Documents:ImageManagerDeluxe:tempJPEGFolder:HA070107_PH_MensHealth1.jpg'"
set TheImage to load image (POSIX path of Choice)
set image of image view "imageDrop" of window "main" to TheImage
else if name of theObject is "delete" then
delete image of image view "imageDrop" of window "main"
end if
end clicked
or a user choice version:
on clicked theObject
if name of theObject is "getpic" then
set userChoice to (choose file with prompt "Choose a file " without invisibles)
set TheImage to load image (POSIX path of userChoice)
set image of image view "imageDrop" of window "main" to load image userChoice
else if name of theObject is "delete" then
delete image of image view "imageDrop" of window "main"
end if
end clicked
As a follow-up to Bruce’s comment, here’s what I used in an application that loads an image file of my choice from a folder of images if the album art of iTunes is missing.
set theFile to (imageFile as string) as file specification
set newImage to load image (theFile)