Hi you all,
I have a script that saves .eps files in several formats - see script
What I would like to edit to this is:
If the current file is photoshop format, do something (save with other settings: ({class:Photoshop save options, save alpha channels:true, save layers:true, embed color profile:true})
In short: I need an “if” for EPS and PSD files
Any help is greatly appreciated!!
–Peter–
set Input_Folder to choose folder with prompt "Kies een map met RGB beelden" without invisibles
--
tell application "Finder"
if not (exists folder "LAY_OUT" of Input_Folder) then
set x to make new folder at Input_Folder with properties {name:"LAY_OUT"}
set EPS_Folder to x as text
else
set EPS_Folder to folder "LAY_OUT" of Input_Folder as text
end if
if not (exists folder "JPEG_OUT" of Input_Folder) then
set y to make new folder at Input_Folder with properties {name:"JPEG_OUT"}
set JPEG_Folder to y as text
else
set JPEG_Folder to folder "JPEG_OUT" of folder Input_Folder as text
end if
set File_List to files in Input_Folder
end tell
--
tell application "Adobe Photoshop CS3"
set display dialogs to never
set User_Rulers to ruler units of settings
set ruler units of settings to pixel units
end tell
--
repeat with This_File in File_List
tell application "Finder"
set The_File to This_File as alias
end tell
tell application "Adobe Photoshop CS3"
activate
open The_File
set Doc_Ref to the current document
tell Doc_Ref
set Doc_Name to name
set Base_Name to my getBaseName(Doc_Name)
tell Doc_Ref
convert to profile "sRGB IEC61966-2.1" intent perceptual with blackpoint compensation and dithering
if (bits per channel is sixteen) then
set bits per channel to eight
end if
resize image resolution 72 resample method bicubic
set Saved_State_1 to current history state
set New_Path to EPS_Folder & Base_Name & ".eps.lay"
save Doc_Ref in file New_Path as Photoshop EPS with options {class:EPS save options, embed color profile:true, encoding:medium quality JPEG, preview type:eight bit TIFF} appending no extension with copying
set current history state to Saved_State_1
if exists path item "Pad 1" then
create selection path item "Pad 1" feather amount 0 with antialiasing
invert selection
fill selection with contents {class:RGB color, red:255, green:255, blue:255}
deselect
else
if exists path item "Pad 1 kopie" then
create selection path item "Pad 1 kopie" feather amount 0 with antialiasing
invert selection
fill selection with contents {class:RGB color, red:255, green:255, blue:255}
deselect
end if
end if
set Pixel_Height to height
set Saved_State_2 to current history state
set New_Path to JPEG_Folder & Base_Name & "_100.jpg"
save Doc_Ref in file New_Path as JPEG with options {quality:6, embed color profile:true} with copying
set current history state to Saved_State_2
resize image height Pixel_Height / 2 resolution 72
set New_Path to JPEG_Folder & Base_Name & "_50.jpg"
save Doc_Ref in file New_Path as JPEG with options {quality:6, embed color profile:true} with copying
set current history state to Saved_State_2
resize image height Pixel_Height / 4 resolution 72
set New_Path to JPEG_Folder & Base_Name & "_25.jpg"
save Doc_Ref in file New_Path as JPEG with options {quality:6, embed color profile:true} with copying
close without saving
end tell
end tell
end tell
end repeat
end
--
tell application "Adobe Photoshop CS3"
set ruler units of settings to User_Rulers
end tell
--
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
display dialog "Beelden zijn verwerkt" buttons {"OK"} default button 1