Add different suffix to each exported file
I have wrote a script which outputs a single image multiple times.
Each either as a different file type or with differnt dimentions/dpi.
This works perfectly however I need it to also add a specific prefix to the files as it exports each out.
for example instead of 'filename.png' it would be 'filename_300dpi.png'
I will copy my script below and hope someone can help a noob scripter like me out.
I will mark up where I believe the new bits of script need to be added and what they should be
EXAMPLE
Thanks
on open AWOrig
tell application "Finder"
set f to (choose folder with prompt "Choose Render Folder")
set Jobno to display dialog "Name Output folder" default answer "OUTPUT"
set TRno to text returned of Jobno as text
set g to f as text
set jobfold to (g & TRno)
if exists folder jobfold then
display dialog "Job Folder Found. Current Files will be overwritten" buttons {"Overwrite", "Quit"}
if the button returned of the result is "Quit" then
error number -128 -- stops executing script
end if
else
make new folder at f with properties {name:TRno}
-- make new folder at jobfold with properties {name:"PNG"}
end if
end tell
tell application "Adobe Photoshop 2022"
set background color to {class:RGB color, red:255, green:255, blue:255}
repeat with AWDoc in AWOrig --Need to add is a repeat variable for multiple files
open AWDoc
set display dialogs to never --So there's no stops in the script, useful for batches
set docnm to name of current document --works out if it needs processing
tell current document
delete every path item
try
make art layer
merge visible layers
try
repeat
delete layer 2
end repeat
end try
end try
set docHeight to height --Setting the height & Width as variables
set docWidth to width --To be able to compare biggest value
if docWidth is greater than or equal to docHeight then
resize image width 3000 resolution 300
else
resize image height 3000 resolution 300
end if
resize canvas width 3000 height 3000 anchor position middle center
save in file f as JPEG with options {class:JPEG save options, embed color profile:true, format options:optimized, matte:background color matte, quality:12}
save in file f as TIFF with options {class:TIFF save options, image compression:LZW, transparency:true}
--save in file PNG_fold as PNG with options {class:PNG save options, compression:1}
save in file f
save in file f as PNG with options {class:PNG save options, compression:1}
SAVE with SUFFIX _300dpi
resize image width 1600
save in file f as JPEG with options {class:JPEG save options, embed color profile:true, format options:optimized, matte:background color matte, quality:12}
SAVE with SUFFIX _1600
resize image height 1500 resolution 150
save in file f as PNG with options {class:PNG save options, compression:1}
SAVE with SUFFIX _150dpi
resize image height 720 resolution 72
save in file f as PNG with options {class:PNG save options, compression:1}
SAVE with SUFFIX _72dpi
close without saving
end tell
end repeat
end tell
end open
