Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Ripped out an old RGB to CMYK post and found a bug can anyone help with it?

Guide ,
Jun 22, 2025 Jun 22, 2025

New CUTTER color plate failed?

Suggestion to archive old posts once the issue is resolved.
6683.png

/**
https://community.adobe.com/t5/indesign-discussions/indesign-script-to-convert-spots-to-cmyk-except-one/m-p/14489457#M566040
**/
#target indesign
app.activeDocument.inks.everyItem().convertToProcess = true;
app.menuActions.item("$ID/Add All Unnamed Colors").invoke();
var myIndesignDoc = app.activeDocument;
var myUnusedSwatches = myIndesignDoc.unusedSwatches;
for (var s = myUnusedSwatches.length - 1; s >= 0; s--) {
    var mySwatch = myIndesignDoc.unusedSwatches[s];
    var name = mySwatch.name;
    if (name != "") {
        mySwatch.remove();
    }
}
var myColorToCheck = app.activeDocument.colors.itemByName("CUTTER");
if (!myColorToCheck.isValid) { app.activeDocument.colors.add({ colorValue: [0, 100, 0, 0], name: "CUTTER" }); };
app.activeDocument.colors.everyItem().properties = { space: ColorSpace.CMYK, model: ColorModel.PROCESS };
app.activeDocument.colors.item("CUTTER").model = ColorModel.SPOT;

 

TOPICS
Bug , Scripting
324
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jun 22, 2025 Jun 22, 2025

Not a bug—there’s no reason to use a menuItem call to make a swatch. Try this:

 

var c = makeSwatch(app.activeDocument, "CUTTER")
c.properties = {model:ColorModel.SPOT, space:ColorSpace.CMYK, colorValue:[0,100,0,0]}

function makeSwatch(d, n){
    if (d.colors.itemByName(n).isValid) {
        return d.colors.itemByName(n);
    } else {
        return d.colors.add({name:n});
    }
}

 

Screen Shot 11.png

Translate
Community Expert ,
Jun 22, 2025 Jun 22, 2025

I would change the cutter color to spot color. RGB makes no sense here.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 22, 2025 Jun 22, 2025

Not a bug—there’s no reason to use a menuItem call to make a swatch. Try this:

 

var c = makeSwatch(app.activeDocument, "CUTTER")
c.properties = {model:ColorModel.SPOT, space:ColorSpace.CMYK, colorValue:[0,100,0,0]}

function makeSwatch(d, n){
    if (d.colors.itemByName(n).isValid) {
        return d.colors.itemByName(n);
    } else {
        return d.colors.add({name:n});
    }
}

 

Screen Shot 11.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 22, 2025 Jun 22, 2025

Hi rob day.

Can color swatches be named with their color value?
Like this: C=0 M=100 Y=0 K=0

dublove_0-1750661118527.jpeg

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 23, 2025 Jun 23, 2025

The 2nd name parameter can be whatever you want

 

var c = makeSwatch(app.activeDocument, "C=0 M=100 Y=0 K=0")

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 23, 2025 Jun 23, 2025
LATEST

That's it, it works.
Thank you very much.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 22, 2025 Jun 22, 2025

At a glance, it looks to me like the script is  taking all unused swatches and removing them, then looking for for a color named CUTTER, and if not found adding it with a value of 0,10,0,0 (why you would want to add it back, if it wasn't used is a mystery to me), then converting everything to CMYK . Finally it converts the CUTTER Swatch to spot.

 

What's the bug?

What is the purpose for the CUTTER color? That sounds like it's meant for a die line, and it should be spot, and set to overprint.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines