Select spot colors based on a text file

Post Reply
User avatar
JimmyHartington
Advanced member
Posts: 310
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: 592
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: 310
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: 365
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: 379
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
User avatar
JimmyHartington
Advanced member
Posts: 310
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: 310
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);

}
Post Reply