How to check does psd file contains spot colours

Participant ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

I started making a script and i get stuck. Is it posible with javascript, from CMYK mode, to check does the psd(with multiply layers) contains spot(pantone) colors, and to make them hidden?

 

Thanks in advance.

 

BR,

Marko

TOPICS
macOS, SDK

Views

96

Likes

Translate

Translate

Report

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

Enthusiast , Jul 20, 2021 Jul 20, 2021
It is effective for learning if you post the code you wrote and get your opinion. I wrote a simple example. I hope it will be useful.var doc = app.activeDocument; var count = 0; if(doc.mode == DocumentMode.CMYK && doc.channels.length > 4){ for(var i = 4; i < doc.channels.length; i++){ if(doc.channels[i].kind == ChannelType.SPOTCOLOR){ count++; } } } alert(count? "is" : "none");

Likes

Translate

Translate
Adobe Community Professional ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

I'm not following 100%, however, yes it is possible to check if there are spot colour channels in a file.

Likes

Translate

Translate

Report

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
Participant ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

Ok, could you help me how? 

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

Sorry, I don't have time now, you should be looking for:

 

ChannelType.SPOTCOLOR

 

If you search the forum or the web, I'm sure that you'll find something. If not, I'll revisit when I have time. 

 

Perhaps somebody else can answer before then. Good luck!

Likes

Translate

Translate

Report

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
Enthusiast ,
Jul 20, 2021 Jul 20, 2021

Copy link to clipboard

Copied

It is effective for learning if you post the code you wrote and get your opinion.
I wrote a simple example. I hope it will be useful.

var doc = app.activeDocument;
var count = 0;
if(doc.mode == DocumentMode.CMYK && doc.channels.length > 4){
    for(var i = 4; i < doc.channels.length; i++){
        if(doc.channels[i].kind == ChannelType.SPOTCOLOR){
            count++;
            }
        }
    }
alert(count? "is" : "none");

 

Likes

Translate

Translate

Report

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
Participant ,
Jul 21, 2021 Jul 21, 2021

Copy link to clipboard

Copied

Thanks guys, this helped me, i just changed one part of your script, and I got what i need.

var doc = app.activeDocument;
var count = 0;
if(doc.mode == DocumentMode.CMYK && doc.channels.length > 4){
    for(var i = 4; i < doc.channels.length; i++){
        if(doc.channels[i].kind == ChannelType.SPOTCOLOR){
            doc.channels[i].visible=false;
            }
        }
    }

 

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
Jul 21, 2021 Jul 21, 2021

Copy link to clipboard

Copied

LATEST

@ajabon - you should post more often!

Likes

Translate

Translate

Report

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