Page 1 of 1

Select spot colors based on a text file

Posted: Fri Sep 22, 2023 2:04 pm
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?

Re: Select spot colors based on a text file

Posted: Fri Sep 22, 2023 2:12 pm
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

Re: Select spot colors based on a text file

Posted: Mon Sep 25, 2023 10:51 am
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.

Re: Select spot colors based on a text file

Posted: Mon Sep 25, 2023 4:14 pm
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?

Re: Select spot colors based on a text file

Posted: Mon Sep 25, 2023 6:22 pm
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

Re: Select spot colors based on a text file

Posted: Mon Sep 25, 2023 10:49 pm
by JimmyHartington
I will try the regex method and report back

Re: Select spot colors based on a text file

Posted: Tue Sep 26, 2023 11:25 am
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);

}

Re: Select spot colors based on a text file

Posted: Tue Jun 04, 2024 4:33 pm
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.

Re: Select spot colors based on a text file

Posted: Wed Jun 05, 2024 10:14 am
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.

Re: Select spot colors based on a text file

Posted: Wed Jun 05, 2024 1:00 pm
by JimmyHartington
Thanks for looking into it bens.
I will look elsewhere to fix the issue.

Re: Select spot colors based on a text file

Posted: Thu Jun 06, 2024 9:21 am
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.