Hello everyone. I’m new at AppleScript Studio, and I have a roadblock that I cannot seem to get past.
I’m making a simple application that displays an image and presents a text input to type a new name for the file. Hitting ENTER renames the file in the Finder to whatever the new filename is, and it automatically appends the original extension. I have gotten that done without a problem.
Where I am stuck is on how to load an external file from some way other than with a “choose file” command. Here are the three lines of code that I have that choose the file, load the image and then display it:
set tmpPath to choose file
set theImage to load image tmpPath
set image of image view "userImage" of window "mainWindow" to theImage
That works just fine. But I want to know what the first line should be changed to for it to load an image whose path is coded into the script, something like:
set tmpPath to "HardDrive:Images:picture.jpg"
set theImage to load image tmpPath
set image of image view "userImage" of window "mainWindow" to theImage
When I try that, it says that “The variable theImage is not defined.” Why am I getting this error, and what can I do to correct it? Any help is greatly appreciated.
Thanks,
Dave