Hi, I’m trying to write a script where I can give the script a folder and it will look through that folder and all subfolders within for any .CR2 files and will use “Image Events” to save a copy of that file as a .TIF file.
So far, I’ve got a basic script that will save a copy of the file with the correct name, extension, and properties, but I don’t know how to make it able to drop a directory on it and have the script look through that folder and all subfolders for the appropriate files.
This is what I have so far:
set myFile to (choose file of type "CR2" without invisibles) as text
set trimmedName to (text 1 thru ((offset of "." in myFile) - 1) of myFile) & ".TIF"
set the targetPath to the (trimmedName) as Unicode text
try
tell application "Image Events"
launch
set thisImage to open myFile
save thisImage as TIFF in targetPath with icon
close thisImage
end tell
on error errorMessage
display dialog errorMessage buttons {"Cancel"} default button 1
end try
Can anyone help point me in the right direction?
Thanks!