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

Batch replacing custom swatch to every Pantone C swatch, single files

Guest
May 26, 2016 May 26, 2016

Copy link to clipboard

Copied

I have a little over a 1,000 PDFs, with each specific PDF representing a Pantone C spot color. In these PDFs there are boxes that are filled with a custom spot color that needs to be replaced with a corresponding Pantone C swatch color...

I've done a lot of searching on the subject but haven't been able to find a good answer. I know no matter what it is going to require a lot of legwork but as of now typing out the 1,000 some spot color names into a script would be incredibly faster than the alternative.

Does anyone know of a script that could get me started on it?

TOPICS
Scripting

Views

813

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 , May 29, 2016 May 29, 2016

Assure all you PDF file's structure  are the same as the sample, open one PDF file and run this code.

(function () {

var doc = activeDocument,

    s = doc.swatches[2];

s.name = activeDocument.name.replace(/\.pdf$/, '');

s.color.spot.color = LABColorByValue ();

function LABColorByValue () {

    var t = doc.textFrames,

        l = t.length,

        i = l - 1,

        c = new LabColor(),

        m;

    for (; i >= 0; i--) {

        m = t.contents.match(/Target: L = (\d*) a\* = (-?\d*) b\* = (-?\d*)/);

        if

...

Votes

Translate

Translate
Adobe
Enthusiast ,
May 27, 2016 May 27, 2016

Copy link to clipboard

Copied

More infos please, a sample document is even better. The script is just somewhere, like waters in the deep dark sea.

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
Guest
May 27, 2016 May 27, 2016

Copy link to clipboard

Copied

Heres a link to a sample document: https://www.dropbox.com/s/e26fzp5jzpedf2h/PANTONE%207436%20C.pdf?dl=0

The green boxes below is where the swatch replacement would occur.

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
Valorous Hero ,
May 27, 2016 May 27, 2016

Copy link to clipboard

Copied

Is the corresponding PANTONE color the one mentioned in the text box? You'll need to create a document with all of the PANTONE colors inside it so that you could reference the swatches, or store them in a text file- which is legally sketchy territory when considering the PANTONE corporation's usage agreement.

So if that pantone's name is correct and if you have a document source for the pantone spot swatches or spreadsheet data with all the correct Lab values, you can do what you need.

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
Enthusiast ,
May 29, 2016 May 29, 2016

Copy link to clipboard

Copied

Assure all you PDF file's structure  are the same as the sample, open one PDF file and run this code.

(function () {

var doc = activeDocument,

    s = doc.swatches[2];

s.name = activeDocument.name.replace(/\.pdf$/, '');

s.color.spot.color = LABColorByValue ();

function LABColorByValue () {

    var t = doc.textFrames,

        l = t.length,

        i = l - 1,

        c = new LabColor(),

        m;

    for (; i >= 0; i--) {

        m = t.contents.match(/Target: L = (\d*) a\* = (-?\d*) b\* = (-?\d*)/);

        if (m) {

            c.l = m[1], c.a = m[2], c.b = m[3];

            return c

        }

    }

}

})()

You can record an action, which insert this script as menu item, to process you files.

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
Guest
May 31, 2016 May 31, 2016

Copy link to clipboard

Copied

Wow, that worked perfectly! I was honestly expecting a lot more I would have to do but didn't think it would be able to match it to the file name, an elegant solution. Thank you!

Although when I run it as a batch script I get Error 8701: the name was not found. Line: 4. -> s.name = activeDocument.name.replace(/\.pdf$/, ");

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
Valorous Hero ,
May 31, 2016 May 31, 2016

Copy link to clipboard

Copied

LATEST

Oh that Target Lab was the color's Lab values? I missed that detail! Hehh heh heh.

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