To get spot channel color data (su as c=100 m =20 y=0 k=0) as the foreground color....because The following process needs the foreground color,I want to simplify the operation process too, My files often have 8 spot channel and 8 layers , All spot channels color data is cmyk .
process :
// =======================================================
var idslct = charIDToTypeID( "slct" );
var desc31 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref24 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
ref24.putName( idLyr, "layer 1" );
desc31.putReference( idnull, ref24 );
var idMkVs = charIDToTypeID( "MkVs" );
desc31.putBoolean( idMkVs, false );
executeAction( idslct, desc31, DialogModes.NO );
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc32 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref25 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idfsel = charIDToTypeID( "fsel" );
ref25.putProperty( idChnl, idfsel );
desc32.putReference( idnull, ref25 );
var idT = charIDToTypeID( "T " );
var ref26 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
ref26.putName( idChnl, "1" );
desc32.putReference( idT, ref26 );
executeAction( idsetd, desc32, DialogModes.NO );
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc33 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref27 = new ActionReference();
var idClr = charIDToTypeID( "Clr " );
var idFrgC = charIDToTypeID( "FrgC" );
ref27.putProperty( idClr, idFrgC );
desc33.putReference( idnull, ref27 );
var idT = charIDToTypeID( "T " );
var desc34 = new ActionDescriptor();
var idCyn = charIDToTypeID( "Cyn " );
desc34.putDouble( idCyn, 10.000000 );
var idMgnt = charIDToTypeID( "Mgnt" );
desc34.putDouble( idMgnt, 20.000000 );
var idYlw = charIDToTypeID( "Ylw " );
desc34.putDouble( idYlw, 50.000000 );
var idBlck = charIDToTypeID( "Blck" );
desc34.putDouble( idBlck, 10.000000 );
var idCMYC = charIDToTypeID( "CMYC" );
desc33.putObject( idT, idCMYC, desc34 );
executeAction( idsetd, desc33, DialogModes.NO );
// =======================================================
var idFl = charIDToTypeID( "Fl " );
var desc35 = new ActionDescriptor();
var idUsng = charIDToTypeID( "Usng" );
var idFlCn = charIDToTypeID( "FlCn" );
var idFrgC = charIDToTypeID( "FrgC" );
desc35.putEnumerated( idUsng, idFlCn, idFrgC );
var idOpct = charIDToTypeID( "Opct" );
var idPrc = charIDToTypeID( "#Prc" );
desc35.putUnitDouble( idOpct, idPrc, 100.000000 );
var idMd = charIDToTypeID( "Md " );
var idBlnM = charIDToTypeID( "BlnM" );
var idNrml = charIDToTypeID( "Nrml" );
desc35.putEnumerated( idMd, idBlnM, idNrml );
executeAction( idFl, desc35, DialogModes.NO );
// =======================================================
var idslct = charIDToTypeID( "slct" );
var desc36 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref28 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
ref28.putName( idLyr, "layer 2" );
desc36.putReference( idnull, ref28 );
var idMkVs = charIDToTypeID( "MkVs" );
desc36.putBoolean( idMkVs, false );
executeAction( idslct, desc36, DialogModes.NO );
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc37 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref29 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idfsel = charIDToTypeID( "fsel" );
ref29.putProperty( idChnl, idfsel );
desc37.putReference( idnull, ref29 );
var idT = charIDToTypeID( "T " );
var ref30 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
ref30.putName( idChnl, "2" );
desc37.putReference( idT, ref30 );
executeAction( idsetd, desc37, DialogModes.NO );
// =======================================================
var idsetd = charIDToTypeID( "setd" );
var desc38 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref31 = new ActionReference();
var idClr = charIDToTypeID( "Clr " );
var idFrgC = charIDToTypeID( "FrgC" );
ref31.putProperty( idClr, idFrgC );
desc38.putReference( idnull, ref31 );
var idT = charIDToTypeID( "T " );
var desc39 = new ActionDescriptor();
var idCyn = charIDToTypeID( "Cyn " );
desc39.putDouble( idCyn, 32.000000 );
var idMgnt = charIDToTypeID( "Mgnt" );
desc39.putDouble( idMgnt, 42.000000 );
var idYlw = charIDToTypeID( "Ylw " );
desc39.putDouble( idYlw, 22.000000 );
var idBlck = charIDToTypeID( "Blck" );
desc39.putDouble( idBlck, 67.000000 );
var idCMYC = charIDToTypeID( "CMYC" );
desc38.putObject( idT, idCMYC, desc39 );
executeAction( idsetd, desc38, DialogModes.NO );
// =======================================================
var idFl = charIDToTypeID( "Fl " );
var desc40 = new ActionDescriptor();
var idUsng = charIDToTypeID( "Usng" );
var idFlCn = charIDToTypeID( "FlCn" );
var idFrgC = charIDToTypeID( "FrgC" );
desc40.putEnumerated( idUsng, idFlCn, idFrgC );
var idOpct = charIDToTypeID( "Opct" );
var idPrc = charIDToTypeID( "#Prc" );
desc40.putUnitDouble( idOpct, idPrc, 100.000000 );
var idMd = charIDToTypeID( "Md " );
var idBlnM = charIDToTypeID( "BlnM" );
var idNrml = charIDToTypeID( "Nrml" );
desc40.putEnumerated( idMd, idBlnM, idNrml );
executeAction( idFl, desc40, DialogModes.NO );