5

I'm trying to script the process of selecting the closest Pantone+ Solid Coated colour from a CMYK reference in Photoshop. Manually the process is:

  1. Click on the Foreground Color picker.
  2. Enter a CMYK breakdown.
  3. Click on the Color Libraries button which gives me the closest Pantone colour.

I'm working in the ExtendScript Toolkit and can use the code below to set a new foreground colour. I'm using the ScriptingListener plugin and the code has come from that hence it's length.

var idsetd = charIDToTypeID( "setd" );
var desc5 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
    var ref2 = new ActionReference();
    var idClr = charIDToTypeID( "Clr " );
    var idFrgC = charIDToTypeID( "FrgC" );
    ref2.putProperty( idClr, idFrgC );
desc5.putReference( idnull, ref2 );
var idT = charIDToTypeID( "T   " );
    var desc6 = new ActionDescriptor();
    var idCyn = charIDToTypeID( "Cyn " );
    desc6.putDouble( idCyn, 97.000000 );
    var idMgnt = charIDToTypeID( "Mgnt" );
    desc6.putDouble( idMgnt, 77.000000 );
    var idYlw = charIDToTypeID( "Ylw " );
    desc6.putDouble( idYlw, 33.000000 );
    var idBlck = charIDToTypeID( "Blck" );
    desc6.putDouble( idBlck, 17.000000 );
var idCMYC = charIDToTypeID( "CMYC" );
desc5.putObject( idT, idCMYC, desc6 );
var idSrce = charIDToTypeID( "Srce" );
desc5.putString( idSrce, """photoshopPicker""" );
executeAction( idsetd, desc5, DialogModes.NO );

What I'm trying to do is get the closest Pantone+ Solid Coated match from the Colour Libraries Picker.

I can see the Pantone reference, in the code that's being generated by the ScriptingListener plugin, it's getting that into a variable I'm stuck on. Please can someone point me in the right direction.

Thanks.

4
  • I don't understand your code, but do you realize that you can't have a pantone color as a foreground color? You can only adjust the current color (rgb or cmyk) to look like the nearest pantone color. Or am I wrong?
    – Wolff
    Commented Jan 28, 2017 at 18:48
  • Are you just trying to solve the issue using any tool, or does this have to be in Photoshop? The CMYKtoPMS Ai plugin may be of use? wundes.com/JS4AI Commented Apr 3, 2017 at 10:49
  • @Wolff you're partly right. You can choose colors from color libraries for FG/BG color (as well as any other color property). It simply performs the conversion into working space process color values. Commented Apr 4, 2019 at 23:24
  • Hi @Mark, old post, but i think what i meant was: the OP wants to "get" the nearest Pantone color. What does he/she mean by "get"? Alert the number? I can't see the use in just adjusting the foreground color to the nearest matching Pantone color, since the only way to get "true" Pantone inks in Photoshop is to create a channel for each ink.
    – Wolff
    Commented Apr 5, 2019 at 14:53

0