I have a script that opens a DCS image, and by way of 2 Actions, creates 4 blank channels, converts to CMYK and then merges the spot channels into the CMYK.
What I would like to do is do away with having to ensure all my operators have the same Actions installed and have the script do it all.
When the 4 new channels are created, they come after the existing spot channels, but need to be moved to positions 1 - 4 (which is possible in the Action). Is it possible with Applescript? I have tried numerous methods and the dictionary/scripting guide for PS is not much help.
Ian, you can only make new channels at end of channels. I did a script some time back that does what your after. I will see if I can find it. As a work around I added 4 channels at end, then duplicated the spots to end then removed the original spots as merge channels automatically consumes the first number of channels in the new colour space. Its cumbersome but works OK.
Thank you! That solution seems to work very well. If you find your old script, I’ll certainly give it a try.
Ian
tell application "Adobe Photoshop CS2"
activate
set ref_doc to current document
tell ref_doc
try
set count_chnnls to count of channels
repeat 4 times
set new_channel to make new channel
select all
fill selection with contents {class:gray color, gray value:0}
end repeat
set current channels to (every channel whose kind is spot color channel)
duplicate current channels to end
delete (channels 1 thru count_chnnls)
change mode to CMYK
set current channels to (every channel whose kind is spot color channel)
merge current channels
end try
end tell
end tell
Ian, more or less the same thing only in my batch images were mixed some multi channels with composite channels so I just wrapped the add channels & duplicate spot channels in if block. You appear to be there anyhow but heres what I had.
set inputFolder to choose folder with prompt "Where are the Multi Channel files."
tell application "Finder"
set filesList to files in inputFolder
set ConvImages to make new folder at desktop with properties ¬
{name:"Converted Images"}
end tell
repeat with aFile in filesList
tell application "Finder"
set theFile to aFile as alias
end tell
tell application "Adobe Photoshop CS2"
activate
set display dialogs to never
open theFile
set docRef to the current document
tell docRef
if not (exists (channels whose kind is component channel)) then
set spot_channels to get name of (every channel whose kind is spot color channel)
make new channel at end with properties {name:"Cyan", kind:component channel}
set the current channels to channel "Cyan"
select all
fill selection with contents {class:RGB color, red:255, green:255, blue:255}
make new channel at end with properties {name:"Magenta", kind:component channel}
set the current channels to channel "Magenta"
select all
fill selection with contents {class:RGB color, red:255, green:255, blue:255}
make new channel at end with properties {name:"Yellow", kind:component channel}
set the current channels to channel "Yellow"
select all
fill selection with contents {class:RGB color, red:255, green:255, blue:255}
make new channel at end with properties {name:"Black", kind:component channel}
set the current channels to channel "Black"
select all
fill selection with contents {class:RGB color, red:255, green:255, blue:255}
deselect
duplicate (every channel whose kind is spot color channel)
repeat with spot_channel in spot_channels
delete channel spot_channel
end repeat
end if
if (mode is not CMYK) then
change mode to CMYK
end if
set current channels to (every channel whose kind is spot color channel)
merge current channels
set docName to name of docRef
set docBaseName to getBaseName(docName) of me
set newFileName to (ConvImages as string) & docBaseName & "_CMYK.tif"
end tell
save docRef in file newFileName as TIFF with options ¬
{class:TIFF save options, image compression:LZW, byte order:Mac OS, save alpha channels:false, save spot colors:false, embed color profile:true, save layers:false, transparency:false}
close current document without saving
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
Mark,
It seems as though we are along the same lines.
If I get a rogue CMYK image in there (unusual), converting to multichannel and back again does not affect the image and saved me some scripting headaches at the time