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

How to check does psd file contains spot colours

Engaged ,
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
Actions and scripting , macOS

Views

350

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

Community Expert , 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");

 

Votes

Translate

Translate
Adobe
Community Expert ,
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.

Votes

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

Copy link to clipboard

Copied

Ok, could you help me how? 

Votes

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
Community Expert ,
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!

Votes

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
Community Expert ,
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");

 

Votes

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
Engaged ,
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;
            }
        }
    }

 

Votes

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

Copy link to clipboard

Copied

LATEST

@ajabon grinsmith - you should post more often!

Votes

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