Select spot colors based on a text file

Post Reply
User avatar
JimmyHartington
Advanced member
Posts: 461
Joined: Tue Mar 22, 2011 7:38 am

Select spot colors based on a text file

Post by JimmyHartington »

I need a good idea.

I would like to be able to select all spot colors, which are listed in a text-file.
This way a customer can add colors to the text-file and the action list in the Switch flow will dynamically remapped these spot colors to one spot color.
But in Pitstop Pro I can not make the list of names to a variable.
Image

Does anybody have a good idea on how to do this?
jan_suhr
Advanced member
Posts: 687
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Select spot colors based on a text file

Post by jan_suhr »

If they can save it to an Excel file you can use this app to solve it:
https://www.enfocus.com/en/appstore/pro ... 2variables
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
User avatar
JimmyHartington
Advanced member
Posts: 461
Joined: Tue Mar 22, 2011 7:38 am

Re: Select spot colors based on a text file

Post by JimmyHartington »

Hi Jan

Thanks for the answer.
The problem is not to get the list to a variabel in Switch.
But more that Select Spot Color does not support to put use a Pitstop variabel as the list.
User avatar
magnussandstrom
Advanced member
Posts: 512
Joined: Thu Jul 30, 2020 6:34 pm
Location: Sweden
Contact:

Re: Select spot colors based on a text file

Post by magnussandstrom »

Could you use "remap spot color" instead of "rename spot color" and loop the action list in switch until all new colors are converted?
loicaigon
Advanced member
Posts: 638
Joined: Wed Jul 10, 2013 10:22 am

Re: Select spot colors based on a text file

Post by loicaigon »

Hi Jimmy,

You can use RegEx instead of List and pass it as variable. Wouldn't that work for you?

(spot|spot2|spot3)

Image

Loic Aigon
Loïc Aigon
Enfocus PitStop Manager
User avatar
JimmyHartington
Advanced member
Posts: 461
Joined: Tue Mar 22, 2011 7:38 am

Re: Select spot colors based on a text file

Post by JimmyHartington »

I will try the regex method and report back
User avatar
JimmyHartington
Advanced member
Posts: 461
Joined: Tue Mar 22, 2011 7:38 am

Re: Select spot colors based on a text file

Post by JimmyHartington »

It works using RegEx.
So I have made a script, which reads a text-file with a list of the spot colors separated by a newline.
It is manipulated into the format "(spot1|spot2|spot3)" and set on the job as Private Data.
And the Private Data is then used in the Pitstop Variable used for selecting the spot color.

Here is the code in my script:

Code: Select all

import * as fs from "fs";

async function jobArrived(s: Switch, flowElement: FlowElement, job: Job) {

    let PDKey: string = await flowElement.getPropertyStringValue("PDKey") as string;
    let file: string = await flowElement.getPropertyStringValue("FileWithColors") as string;
    let inputColors = await fs.readFileSync(file, "utf-8");
    let regEx = await inputColors.split(/\r?\n/).join("|") as string;
        
    await job.setPrivateData(PDKey, "(" + regEx + ")");

    await job.sendToData(Connection.Level.Success);

}
User avatar
JimmyHartington
Advanced member
Posts: 461
Joined: Tue Mar 22, 2011 7:38 am

Re: Select spot colors based on a text file

Post by JimmyHartington »

As I have written earlier I got a solution for my problem.
And it has worked flawless until now.

But I have just today processed some pdf-files, where it does not work.
See this example file: https://d.pr/f/dZDvdX

It has a spot-color named "KAPVORM" as far as I can see.
I add it to my text-file with the list of colors, which needs to remapped to "Cutter".
But it does not remap. It still works with other PDF-files where other colors from the list.

I have tried to look at an XML-report of the PDF to see if the color was named "KAPVORM " or something else.
So I would like to hear if anybody could spare a moment to analyse the pdf to see if the spot-color has anything weird about it.
bens
Advanced member
Posts: 282
Joined: Thu Mar 03, 2011 10:13 am

Re: Select spot colors based on a text file

Post by bens »

Hi Jimmy,

There is indeed a Separation "KAPVORM" in that file. There are no special characters or any other issues I can see - it's simple ASCII. I don't know why it wouldn't work.

I tried regular expression "(KAPVORM|Snijlijn)" in PitStop Pro, and both selecting and renaming worked. So the problem must be elsewhere.
User avatar
JimmyHartington
Advanced member
Posts: 461
Joined: Tue Mar 22, 2011 7:38 am

Re: Select spot colors based on a text file

Post by JimmyHartington »

Thanks for looking into it bens.
I will look elsewhere to fix the issue.
User avatar
JimmyHartington
Advanced member
Posts: 461
Joined: Tue Mar 22, 2011 7:38 am

Re: Select spot colors based on a text file

Post by JimmyHartington »

Ahh. Sometimes I miss something obvious.
The color KAPVORM which is for a cutter line is expanded, so it is fill color.
And my action selects only stroke colors.
So that is why nothing happens.
Post Reply