I have used this script to downsize my files… with some success. My problem is that is not using the save for web feature of photoshop. Anyone know how to modify the following script to use photoshop’s Save for WEB feature. My current workaround is setting image previews to never in the cs3 preferences:file handling.
Thanks
on compileAsOption(valStr)
tell application "Adobe Photoshop CS3"
run script "tell application \"Adobe Photoshop CS3\" to return {«class fltp»:" & valStr & "}"
end tell
end compileAsOption
set inputFolder to choose folder with prompt "Pick your TOP level folder!"
--
tell application "Finder"
set filesList to (files of entire contents of inputFolder)
end tell
--
repeat with aFile in filesList
set fileIndex to 0
tell application "Finder"
set theFile to aFile as alias
set theFileName to name of theFile
set the subFolder to the container of theFile
end tell
--
tell application "Adobe Photoshop CS3"
activate
set UserPrefs to properties of settings
set ruler units of settings to pixel units
--
open theFile showing dialogs never
set docRef to the current document
tell docRef
set docName to name of docRef
set docBaseName to getBaseName(docName) of me
--if (mode is not RGB) then
--change mode to RGB
--end if
--if (bits per channel is sixteen) then
--set bits per channel to eight
--end if
--set myOptions to {class:save for web export options, optimized size:true, quality:40, with profile:false} & my compileAsOption("JPEG") --I added a couple of additional options I use. Feel free to delete if you don't want them
--set myExportOptions to {«class fltp»:JPEG, quality:40}
--resizing images proportionaly and non proportionaly scaled
--
resize image height 240 resolution 72 resample method bicubic sharper
set newFileName to (subFolder as string) & docBaseName & ".jpg"
save docRef in file newFileName as JPEG with options ¬
{quality:6} appending lowercase extension with copying
--
resize image height 120 resolution 72 resample method bicubic sharper
set newFileName to (subFolder as string) & "th_" & docBaseName & ".jpg"
save docRef in file newFileName as JPEG with options ¬
{quality:6} appending lowercase extension with copying
end tell
--
close current document saving no
--
set ruler units of settings to ruler units of UserPrefs
--
end tell
end repeat
--
on getBaseName(fName)
set baseName to fName
repeat with idx from 1 to (length of fName)
if (item idx of fName = ".") then
set baseName to (items 1 thru (idx - 1) of fName) as string
exit repeat
end if
end repeat
return baseName
end getBaseName