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

Script to add suffix to spot channel names with sequential numbers?

Explorer ,
Jan 08, 2021 Jan 08, 2021

Copy link to clipboard

Copied

Is it possible to ignore the top channel which is usually called 'grey' when in grey mode, and rename all others to have a number as a suffix, so spot channels would be like:

 

Grey

Red 185

Yellow 101

Black

 

and then after running the script it'd look like

 

Grey

Red 185 - 1

Yellow 101 - 2

Black - 3

 

Many thanks in advance 😄

TOPICS
Actions and scripting

Views

312

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

People's Champ , Jan 08, 2021 Jan 08, 2021

Try this

 

var ch = app.activeDocument.channels;

var n = 0;

for (var i = 0; i < ch.length; i++)
    {
    if (ch[i].kind != ChannelType.SPOTCOLOR) continue;

    ++n;

    ch[i].name += " - " + n;
    }

Votes

Translate

Translate
Adobe
People's Champ ,
Jan 08, 2021 Jan 08, 2021

Copy link to clipboard

Copied

Try this

 

var ch = app.activeDocument.channels;

var n = 0;

for (var i = 0; i < ch.length; i++)
    {
    if (ch[i].kind != ChannelType.SPOTCOLOR) continue;

    ++n;

    ch[i].name += " - " + n;
    }

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
Explorer ,
Jan 14, 2021 Jan 14, 2021

Copy link to clipboard

Copied

Thank you so much 🙂

If I wanted it as a prefix instead of a suffix how would I go about amending the script?

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
LEGEND ,
Jan 14, 2021 Jan 14, 2021

Copy link to clipboard

Copied

LATEST
ch[i].name = n + ' - ' + ch[i].name

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