Chris, if using an action, I would use the channels/merge channels command rather than copy/paste etc. The main issue is that an action will record the explicit file names used for the channels, so actions can be very limited when one is dealing with variable names. One viable work around could be to dupe/rename/close the original file names to a standard fixed name that would be used to merge the channels via an action. I have made this work via an action on a single set of four opened files, however I am not sure if this could work via a batch action on multiples sets. I can’t get the following script to work, however somebody else may be able to find out why there are errors (I am using CS6, also tried in CS5): https://gist.github.com/moluapple/1333451 PS_Merge Multiple Single-Channel-Files to One Multi-Channels File
(function (){
var f = Folder.selectDialog ('选择文件夹'),
fA = f.getFiles ('*.tif'),
fs = f.fsName,
op = new TiffSaveOptions,
i = 0;
op.imageCompression = TIFFEncoding.TIFFLZW; // 设置LZW压缩
for (; i < fA.length; i += 5){
process (fA);
}
function process (base) {
var fn = base.name.split('_')[0],
PMS = unescape(f.getFiles (fn + '*.tif').toString().match(/(Pantone.+?)\.tif/)[1]),
F = function (str){return File(fs + '/' + fn + '_' + str +'.tif')},
_C = F('Cyan'),
_M = F('Magenta'),
_Y = F('Yellow'),
_K = F('Black'),
_S = F(PMS),
loop = [_M, _Y, _K, _S],
mDoc = app.open(_C),
i = 0,
doc;
mDoc.changeMode(ChangeMode.MULTICHANNEL);
for (; i < 4; i++){
doc = app.open(loop);
doc.channels[0].duplicate (mDoc);
doc.close(SaveOptions.DONOTSAVECHANGES);
}
mDoc.channels[4].name = PMS.toUpperCase();
mDoc.channels[4].kind = ChannelType.SPOTCOLOR;
setPMSColor(PMS);
mDoc.changeMode(ChangeMode.CMYK);
mDoc.saveAs(F('合并'), op);
mDoc.close(SaveOptions.DONOTSAVECHANGES);
}
// ScriptingListenerJS Code
function setPMSColor(str) {
var idsetd = charIDToTypeID("setd");
var desc20 = new ActionDescriptor();
var idnull = charIDToTypeID("null");
var ref12 = new ActionReference();
var idChnl = charIDToTypeID("Chnl");
var idOrdn = charIDToTypeID("Ordn");
var idTrgt = charIDToTypeID("Trgt");
ref12.putEnumerated(idChnl, idOrdn, idTrgt);
desc20.putReference(idnull, ref12);
var idT = charIDToTypeID("T ");
var desc21 = new ActionDescriptor();
var idClr = charIDToTypeID("Clr ");
var desc22 = new ActionDescriptor();
var idBk = charIDToTypeID("Bk ");
desc22.putString(idBk, "PANTONE? solid coated");
var idNm = charIDToTypeID("Nm ");
desc22.putString(idNm, str);
var idbookID = stringIDToTypeID("bookID");
desc22.putInteger(idbookID, 3002);
var idbookKey = stringIDToTypeID("bookKey");
desc22.putData(idbookKey, ' ' + str.replace(/\s/g, '').replace(/pantone/i, ''));
var idBkCl = charIDToTypeID("BkCl");
desc21.putObject(idClr, idBkCl, desc22);
var idSCch = charIDToTypeID("SCch");
desc20.putObject(idT, idSCch, desc21);
executeAction(idsetd, desc20, DialogModes.NO);
}
})();
This script appears to be merging channels to multichannel mode and assigning a CMYK spot colour to each separation and possibly a 5th plate spot colour. In your case this is just a direct merge to CMYK mode rather than multichannel.
... View more