Pantone ColorBook
Posted: Thu May 14, 2009 8:52 pm
Hi X,
I modified your ColorBookDemo.js (great job btw) to select a Pantone from the Pantone solid coated color book but just had a few questions.
In your original demo the log window displays the full Pantone name but in my function below the name only shows the actual number. This is all I need to find the pantone by number but I'm just curious about why the name is different from your log window.
Secondly, is there a way to set the foregroundColor as the actual Pantone instead of the lab value of the swatch? I tried listener code but it requires bookID and name which I can't see a way of accessing.
Code: Select allfunction main() {
if ( isPS7() ) {
alert( "For unknown reasons, this script cannot execute in PS7 correctly." );
return;
}
var folder = new Folder( app.path + "/Presets/Color Books" );
var cb_file = "Pantone Solid Coated.acb";
var pantone_num = prompt( 'Enter Pantone Number', '' );
var cb = new ColorBook();
cb.readFromFile( folder + "/" + cb_file );
for ( var j = 0; j < cb.numberOfColors; j++ ) {
if ( cb.colors[j].name == pantone_num ) {
app.foregroundColor.lab = cb.colors[j].color;
return;
}
}
};
I modified your ColorBookDemo.js (great job btw) to select a Pantone from the Pantone solid coated color book but just had a few questions.
In your original demo the log window displays the full Pantone name but in my function below the name only shows the actual number. This is all I need to find the pantone by number but I'm just curious about why the name is different from your log window.
Secondly, is there a way to set the foregroundColor as the actual Pantone instead of the lab value of the swatch? I tried listener code but it requires bookID and name which I can't see a way of accessing.
Code: Select allfunction main() {
if ( isPS7() ) {
alert( "For unknown reasons, this script cannot execute in PS7 correctly." );
return;
}
var folder = new Folder( app.path + "/Presets/Color Books" );
var cb_file = "Pantone Solid Coated.acb";
var pantone_num = prompt( 'Enter Pantone Number', '' );
var cb = new ColorBook();
cb.readFromFile( folder + "/" + cb_file );
for ( var j = 0; j < cb.numberOfColors; j++ ) {
if ( cb.colors[j].name == pantone_num ) {
app.foregroundColor.lab = cb.colors[j].color;
return;
}
}
};