I’m fairly new to AppleScript but, with the help of a few other folk I’ve succeeded in writing a script which works to:
Choose a folder full of photos
Make 2 new folders within that folder
Take the photos and copy them into the 2 new folders
Perform a Photoshop action on all files in each of the folder
So, I end up with 2 new versions of all the photos and also keep the originals.
This is the script:
set original_folder to (choose folder with prompt “Choose Folder containing the files”)
tell application “Finder”
if not (exists folder “Webpics” of original_folder) then make new folder at original_folder with properties {name:“Webpics”}
if not (exists folder “Webthumbs” of original_folder) then make new folder at original_folder with properties {name:“Webthumbs”}
set copies_folder to folder “Webpics” of original_folder
set copies2_folder to folder “Webthumbs” of original_folder
duplicate every file of original_folder to copies_folder
set the_files to every file of copies_folder
repeat with each_file in the_files
set each_file to each_file as alias
my do_photoshop_stuff_to(each_file)
end repeat
duplicate every file of copies_folder to copies2_folder
set webthumbs_folder to folder “Webthumbs” of original_folder
set the_files to every file of webthumbs_folder
repeat with each_file in the_files
set each_file to each_file as alias
my do_photoshop_stuff2_to(each_file)
end repeat
end tell
on do_photoshop_stuff_to(this_file)
tell application “Adobe Photoshop CS”
open this_file
do action “Masterpic to Webpic” from “Set 1.atn”
close current document saving yes
end tell
end do_photoshop_stuff_to
on do_photoshop_stuff2_to(this_file)
tell application “Adobe Photoshop CS”
open this_file
do action “Webpic to Webthumb” from “Set 1.atn”
close current document saving yes
end tell
end do_photoshop_stuff2_to
There are 2 extra things which I’ve been trying to add but seem to be failing…
1: I’d like to be able to add the letter w to the end of the file name of all of the photos which end up in the webpics folder and the letter t to the end of all the photos which end up in the webthumbs folder.
2: I’d also like to “save for web” the photos in both the webpics and webthumbs folders. I’ve currently got an ImageReady droplet which I use but I’d love to be able to script this in too.
I’ve searched through all the renaming posts and “save for web” posts on the forum here and tried versions of all of them but can’t get any of them to work…I’ve also tried using the script together with Automator but again haven’t quite got there.
So, ultimately I’d end up with something that starts with:
Choose Folder (e.g. “XYZ” containing e.g. file123.jpg)
and ends up with:
Folder “XYZ”
containing original file123.jpg
and containing folder “webpics” with optimised file123w.jpg (which has been through my Photoshop action and saved for web)
and also containing folder “webthumbs” with optimised file123wt.jpg (which has been through my other Photoshop action and saved for web)
Hope this all makes sense. I’ve spent the day trying to sort it out myself but I just don’t know enough about Scripting so if anyone out there can help I’d be hugely grateful. I’m on OS 10.4.4 and Photoshop CS.
Cheers, Eddy