Search found 103 matches

by cstevens
Tue May 14, 2019 1:01 am
Forum: Flows
Topic: HP Digital Front End JDF Control
Replies: 3
Views: 8213

Re: HP Digital Front End JDF Control

What type of press are you driving through JDF?
What settings do you have in the configurator and what are you hoping to have happen?
by cstevens
Mon May 06, 2019 4:56 pm
Forum: LEGACY scripting
Topic: script get oldest file from directory
Replies: 2
Views: 5119

Re: script get oldest file from directory

I normally do an entryList on a Dir object for something like this: function timerFired( s : Switch ) { var inFolder = new Dir("C:/Shared"); var fileList = inFolder.entryList("*.pdf", Dir.Files, Dir.Time|Dir.Reversed); s.log(1, "Oldest file in folder is: " + fileList[0]...
by cstevens
Tue Apr 23, 2019 5:11 pm
Forum: LEGACY scripting
Topic: RegEx replace in Script expression
Replies: 4
Views: 7257

Re: RegEx replace in Script expression

you can also use the String.split('_') and Array.join('_') methods to convert these strings into an array and then modify the 3rd instance of the array: var inString = "a1b2c3_DDYYKK_123_ABC_X1Y1Z1"; var strArray = inString.split('_'); strArray[2] = "456"; inString = strArray.joi...
by cstevens
Fri Mar 08, 2019 9:13 pm
Forum: Flows
Topic: .bat variables in Switch
Replies: 2
Views: 4171

Re: .bat variables in Switch

I think you'd have to output it to stdout or stderr and then switch could capture that. It's not going to be able to search through external code to find variables.
by cstevens
Fri Mar 01, 2019 12:55 am
Forum: LEGACY scripting
Topic: Submit point script expression question
Replies: 4
Views: 7341

Re: Submit point script expression question

I did a little with submit points, but I'm not sure if you can push data back into the submit point GUI. You can capture the data set associated with a submit point like this: var submitData = job.getDataset("Submit"); //"Submit" I believe is the name of your submit point that yo...
by cstevens
Tue Feb 19, 2019 6:32 pm
Forum: Flows
Topic: XML Pickup for Multiple Values
Replies: 8
Views: 11671

Re: XML Pickup for Multiple Values

I think this is a limitation with the XML Pickup module. Expressions like this can only resolve to a single value, so when an XPath resolves to multiple values it either errors or returns the first value in the list. I think you'll need to use a script expression that evaluates to a node list and th...
by cstevens
Fri Jan 18, 2019 6:45 pm
Forum: LEGACY scripting
Topic: Changing values in XML xpath
Replies: 5
Views: 8499

Re: Changing values in XML xpath

Sorry, I thought that's what you wanted based on your description. That actually makes the script a bit easier: function jobArrived( s : Switch, job : Job ) { var ADD_PAGES = 16; //Open the incoming file as an XML document var xmlDoc = new Document(job.getPath()); //Get the Products nodes var produc...
by cstevens
Thu Jan 17, 2019 10:02 pm
Forum: LEGACY scripting
Topic: Changing values in XML xpath
Replies: 5
Views: 8499

Re: Changing values in XML xpath

Don't think this can be done outside of scripting, but here's how you could do it in scripting (assuming the XML is a file coming into the script element): function jobArrived( s : Switch, job : Job ) { var ADD_PAGES = 16; //Open the incoming file as an XML document var xmlDoc = new Document(job.get...
by cstevens
Thu Dec 06, 2018 10:59 pm
Forum: LEGACY scripting
Topic: XML to a String
Replies: 1
Views: 4058

Re: XML to a String

Just read it in like a normal text file: var xmlString = File.read(job.getPath()); I've used this in the past with regular expressions to find something without knowing where it is in the XML structure, or in XML formats that aren't supported in Switch like cXML. I believe you need to be careful if ...
by cstevens
Thu Nov 29, 2018 10:08 pm
Forum: LEGACY scripting
Topic: POST JSON to API with HTTP Request
Replies: 4
Views: 7637

Re: POST JSON to API with HTTP Request

Yes, I have to do custom authentication so I don't have a choice.
by cstevens
Thu Nov 29, 2018 5:30 pm
Forum: LEGACY scripting
Topic: POST JSON to API with HTTP Request
Replies: 4
Views: 7637

Re: POST JSON to API with HTTP Request

I haven't used make JSON or basic authentication, but I've created a couple scripts that do authenticated RESTful API calls. One takes a .json input file and just attaches it to the HTTP client using: httpClient.setAttachedFile(jsonBodyLoc); //where jsonBodyLoc is the location of the incoming JSON f...
by cstevens
Mon Nov 05, 2018 5:27 pm
Forum: Imposition
Topic: HP SmartStream Designer imposition crashing
Replies: 2
Views: 8685

Re: HP SmartStream Designer imposition crashing

13.04 had a bug that does not support automation (switch or otherwise)

You'll need to upgrade to 13.1 or wait for 14 on cc 2019
by cstevens
Wed Oct 24, 2018 9:25 pm
Forum: Flows
Topic: Release files at a certain time
Replies: 7
Views: 7030

Re: Release files at a certain time

You can also have a 2nd flow which is scheduled to start at 20:00, run for a couple minutes and shut down. That's how I've handed this type of thing in the past before they improved the hold element.
by cstevens
Tue Sep 11, 2018 9:56 pm
Forum: LEGACY scripting
Topic: Info from unknown XML
Replies: 3
Views: 8372

Re: Info from unknown XML

You may need to loop through the individual nodes to get each value. Something like function jobArrived( s : Switch, job : Job ) { //assuming this XML file is coming into the script element as a file instead of metadata var xmlDoc = new Document(job.getPath()); var kindNodes = xmlDoc.evalToNodes(&qu...
by cstevens
Tue Aug 14, 2018 6:22 pm
Forum: LEGACY scripting
Topic: Replace single XML node value
Replies: 5
Views: 7577

Re: Replace single XML node value

I've had a similar issue with the APP store, I think it has something to do with our firewall. With the scripting module you can do something like this: function jobArrived( s : Switch, job : Job ) { var xmlDoc = new Document(job.getPath()); var journalIdNode = xmlDoc.evalToNode("/issue-xml/jou...