Copy link to clipboard
Copied
Hello everyone, back again haha, same script.
Every once in a while I would get a non implemented error when I tried to print. I was able to narrow it down to exactly what was causing the problem, the spots from the pantone solid coated library. These spots are book/lab color-mode as opposed to cmyk. When I convert them to cmyk, the script would work without an error.
Technically the line that has the error is line 35 when it is printed, but from further trial and error I found out what is really causing it is when I try to give the new separation options an ink list in line 27. This will work when the spots are all cmyk, and it will have that 'non implemented' error when there is a spot with a lab color. Here is a snippet of the problem.
docRef = app.activeDocument;
app.coordinateSystem = CoordinateSystem.ARTBOARDCOORDINATESYSTEM;
printPostScript();
function printPostScript() {
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
var jobOpts = new PrintJobOptions();
var opts = new PrintOptions();
opts.jobOptions = jobOpts;
opts.PPDName = 'AdobePdf';
opts.printerName= 'Adobe PostScript File';
var sepOpts = new PrintColorSeparationOptions();
sepOpts.colorSeparationMode = PrintColorSeparationMode.HOSTBASEDSEPARATION;
//here is the error
sepOpts.inkList = docRef.inkList;
opts.colorSeparationOptions = sepOpts;
docPath3 = decodeURI( '~/Desktop/comps/' + 'dud' + '.ps' );
jobOpts.file = File( docPath3 );
app.activeDocument.print( opts );
};
So yea, not sure why that is happening. I am able to print lab spot colors fine through ui , not sure why the error is there, do I need to convert them through script somehow? or is there some kind of setting that would fix this?
Thanks in advance!
Yes, there sure is!
Use app.convertSampleColor() <-- the destination parameter is actually required for this to not fail, so use undefined in parameters that you don't care about remembering or writing.
It will return an array of numbers, which you are free to use how you see fit.
I made my own function to wrap it for an added level of convenience:
function convertAppColor(src,dest,clrArr){
return app.convertSampleColor(ImageColorSpace[src], clrArr, ImageColorSpace[dest], ColorConvertPurpose.defa
...Copy link to clipboard
Copied
This is a head-scratcher.
Copy link to clipboard
Copied
Yea I can't find out why the script doesn't like the lab colors because it has no problem when I do it manually. I guess the next step is to figure out if it's possible to change a spot color from lab to cmyk via script. It is easy to do manually, you just double click on the swatch and the color mode drop down is right there.
var docRef = app.activeDocument;
for (i = 0; i < docRef.swatches.length; i++) {
if (docRef.swatches.color == '[SpotColor]') {
if (docRef.swatches.color.spot.colorType == ColorModel.SPOT && docRef.swatches.color.spot.spotKind == SpotColorKind.SPOTLAB) {
docRef.swatches.color.spot.spotKind = SpotColorKind.SPOTCMYK;
}
}
}
This won't work of course haha. Does anyone know if this is possible?
Thanks everyone!
Copy link to clipboard
Copied
I think you've also got to assign the color values, because CMYK needs 4 color values, but the one you've got in the spot only has 3.
Copy link to clipboard
Copied
Ah, ok you have to give it values. So I take it there is no way to auto convert colors like you can through UI?
Copy link to clipboard
Copied
Yes, there sure is!
Use app.convertSampleColor() <-- the destination parameter is actually required for this to not fail, so use undefined in parameters that you don't care about remembering or writing.
It will return an array of numbers, which you are free to use how you see fit.
I made my own function to wrap it for an added level of convenience:
function convertAppColor(src,dest,clrArr){
return app.convertSampleColor(ImageColorSpace[src], clrArr, ImageColorSpace[dest], ColorConvertPurpose.defaultpurpose);
}
So a typical use would be:
var myColorArr = convertAppColor("LAB","CMYK", mySpot.getInternalColor());
Copy link to clipboard
Copied
Awesome, seems to work well.
var docRef = app.activeDocument;
function convertAppColor(src,dest,clrArr){
return app.convertSampleColor(ImageColorSpace[src], clrArr, ImageColorSpace[dest], ColorConvertPurpose.defaultpurpose);
}
var mySpot = docRef.spots.getByName ('PANTONE Yellow 012 C');
var myColorArr = convertAppColor("LAB","CMYK", mySpot.getInternalColor());
newCMYKColor = new CMYKColor();
newCMYKColor.black = myColorArr[3];
newCMYKColor.cyan = myColorArr[0]
newCMYKColor.magenta = myColorArr[1];
newCMYKColor.yellow = myColorArr[2];
mySpot.color = newCMYKColor;
Looks like this will solve that problem. Thank you so much!
Copy link to clipboard
Copied
Okay good, and I was totally just kidding about using undefined parameters for this, as it's one where those parameters previous to the destination are quite required. I was just cross-remembering another function, ooopse.
Copy link to clipboard
Copied
haha no problem. Thanks again!
Copy link to clipboard
Copied
Oh yea, so, not really an issue, unless it is.. but you know, I am not sure if the PANTONE CMYK values as defined by the book makers are going to be the same as the ones produced by this app color conversion.
What am I talking about, you're doing separations! Duh, I forgot what this was all about in the first place!
Copy link to clipboard
Copied
haha yea sometimes we switch orders to heat press transfers though so that is good to know. I think our printer profiles have their own values they assign to pms colors so it should be good.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now