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);
}