Basic sorting by stats.colorants

Post Reply
dmorgan
Newbie
Posts: 8
Joined: Thu Apr 16, 2020 9:46 pm

Basic sorting by stats.colorants

Post by dmorgan »

Hi everyone,

I have the simplest of workflow branches that I'm having a hard time getting around, and I'm sure there's an "easy way", but my not understanding all the commands is giving me trouble.

Short description: I need to figure out how to look at the spot colors in a document and have them go down a particular path if they start with a character I specify. So if a job has 10 different spot colors, and one has a "T" -> I need it to go down the path for "T" when I need it to.

Sorting by Stats.colorants "starts with" ""T" doesn't seem to work when there are multiple other colors in the doc.


Much longer version (apologies in advance, really...)

Here's what I'm trying to do:
On all our incoming jobs, we have the spot colors built into the text indicating process. Example below:
EBLK = black engraving
TRED = red thermography
FGLD = Gold foil
...and so on

We have default plate setups for these various processes. I'm good with those. The trouble is when we have a PDF that has multiple processes in it. I have to impose those differently depending on the combination.

So I have a section of workflow that (*tries to) send jobs through various paths to be tagged with the process.
If I sort by [stats.colorants] "starts with" "x" where the "x" I've replaced with the prefix I need, it usually works great, but only if a single process/prefix in the PDF.

Image

But we have many jobs with multiple processes that I'm trying to catch here. This will be important at other points in the flows too, but I need to get it to work here and understand how to sort the way I need to here.

In this example, I have a series of PDFs I created out of a single InDesign document with the following color combinations:

#1. TRED
#2. ERBL
#3. LHGR
#4. MBLK (we use M for foil. Don't ask.. our IT department decided that long ago)
#5. TRED ERBL LHGR MBLK (it has all 4 colors in it)

The first 4 individual files go through the flow fine. They only contain one spot color. Using a branch sorting by the prefix of the colorant works fine, but they only contain one spot color each. They all get tagged with the appropriate process name.

When I send that file with 4 colors in it, I expect it to hit all 4 branches as it goes along, as it has all 4 prefixes in the spot colors. But it doesn't.
So, if I send a job with a hundred spot colors down the path, and it has one "T" color, I need to look at all the spot colors in the PDF and see that one has a "T" and sort it down the right lane

Sorry if this was really long, I don't know how to shorten it and still seem coherent.

I truly appreciate any help.
Many thanks,
Dan
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Basic sorting by stats.colorants

Post by Padawan »

Depending of the used spot colors, Stats.Colorants can have any of these values:

ERBL;LHGR;TRED
TRED;ERBL;LHGR
ERBL;TRED;LHGR

In all situations where T of the first letter of the colorant you either have:
";T" (The list delimiter + T, this is for all mentions of a colorant starting with T except the first one)
"T" (In case the colorant with T is mentioned as the first colorant)

You can catch both of these with a regular expression:
^T.* => If it matches this, then the complete Stats.Colorants string starts with a T (^ stands for start of string, T is used litterally and .* means any character repeated 0 or more times)
.*;T.* => If it matches this, then there is a ";T" somewhere in the colorants string. ( it is ;T with before and after it any character repeated 0 or more times
(^T.*|.*;T.*) => If it matches this, then either the colorants start with T or it contains a ;T (It is the combination of the previous two regular expressions)

So if you setup a condition where:
[Stats.Colorants] matches (^T.*|.*;T.*)
Screenshot 2020-04-23 at 11.07.41.png
Screenshot 2020-04-23 at 11.07.41.png (144.18 KiB) Viewed 3431 times

Then you should be able to sort out any PDF with a spot starting with T. For any spot starting with M this becomes:
[Stats.Colorants] matches (^M.*|.*;M.*)
dmorgan
Newbie
Posts: 8
Joined: Thu Apr 16, 2020 9:46 pm

Re: Basic sorting by stats.colorants

Post by dmorgan »

Oh wow, very cool. That works perfectly, and your explanation of the way the a regular expression works is one of the better ones and I actually understand that a lot more now, even though this is a very simple operation. I know lots of folks might chuckle at how easy that was, but that makes a world of difference to me, when I have very little experience with coding.

Thank you Padawan.

-Dan
Post Reply