I have a script saved as an app that processes 2 image files. They both have the same name but one of them has “@2x” at the end. For example “myimage.png” and “myimage@2x.png”
At the moment I drop the first image onto the app (“myimage.png”), and it pops up a prompt to choose the second image (“myimage@2x.png”). It then runs a shell script on both of them.
What I’d like to do if possible is drop both images onto the app and it would set the first image (“myimage.png”) to “normalImage” and the second image (“myimage@2x.png”) to “retinaImage” by somehow reading the name, so that you don’t have to drop the single image first onto the app and then select the second one afterwards.
Here’s the script;
on open these_items
set normalImage to POSIX path of these_items
set retinaImage to POSIX path of (choose file with prompt "Select the @2x version of your image:" of type {"png"} default location (path to desktop folder))
tell application "Finder" to set ImageName to text 1 thru -5 of (get name of file these_items)
set combinedTIFF to POSIX path of (path to desktop folder) & ImageName & "_retina.tiff"
do shell script "tiffutil -cathidpicheck" & space & quoted form of normalImage & space & quoted form of retinaImage & space & "-out" & space & quoted form of combinedTIFF
end open
Any help would be appreciated.