Search found 106 matches

by cstevens
Fri Mar 16, 2018 10:29 pm
Forum: Flows
Topic: Settings for Unique id?
Replies: 2
Views: 6394

Re: Settings for Unique id?

Switch will remove the unique ID from the file name in the last folder of any flow as long as the Strip unique name property is set to yes. You can terminate your flow at the point where XMF picks it up and start a new flow where it returns to Switch. If you're worrying about file name conflicts swi...
by cstevens
Wed Feb 28, 2018 7:29 pm
Forum: LEGACY scripting
Topic: Check XML using xpath or script?
Replies: 4
Views: 8004

Re: Check XML using xpath or script?

I'm not sure if you can use conditions with variables for XPaths that resolve to multiple nodes. The XPath you're looking for is probably something like this: /Root/IPN/CustomerProducts/Products[ProductComponents/@PageCount='0']/@ProductName where you would compare the string result not equal to &qu...
by cstevens
Wed Feb 21, 2018 5:17 pm
Forum: LEGACY scripting
Topic: How to replace an xml value
Replies: 4
Views: 8533

Re: How to replace an xml value

It also looks like your script doesn't have a proper entry point function. It should be wrapped like this:

Code: Select all

function jobArrived( s : Switch, job : Job )
{
}
or if using a timer this:

Code: Select all

function timerFired( s : Switch )
{
}
by cstevens
Tue Feb 20, 2018 5:56 pm
Forum: Applications
Topic: SmartStream Banner JDF
Replies: 19
Views: 39627

Re: SmartStream Banner JDF

You can set Banners and Dividers in the JDF configurator:

Image

Is there something other than what is currently available that you need to do?

Also note that Banner sheets are only supported on series 3 and 4 presses (7x00, 10,000, 12,000 etc.)
by cstevens
Tue Feb 06, 2018 11:08 pm
Forum: Flows
Topic: Using mjm for JDF pickup
Replies: 6
Views: 13556

Re: Using mjm for JDF pickup

Good to know. Thanks for sharing. Were you able to do it with the free version, or did you have to buy the Deluxe version?
by cstevens
Fri Jan 05, 2018 6:29 pm
Forum: Flows
Topic: Using mjm for JDF pickup
Replies: 6
Views: 13556

Re: Using mjm for JDF pickup

I know the HTTP component can create MIME packages, but I haven't seen anything in Switch that can extract the different components. It looks like there are some command-line utilities out there that you could possibly use with the Execute Command http://www.fpx.de/fp/Software/UUDeview/download/uude...
by cstevens
Tue Dec 19, 2017 11:54 pm
Forum: LEGACY scripting
Topic: SHA1 / SHA256 Message Authentication
Replies: 2
Views: 5621

Re: SHA1 / SHA256 Message Authentication

I had to create my HMAC hash in an external program and call that from Switch. Couldn't find a way in Switch to do it. It might be possible using ByteArray.generateSignature(), but it sounds like that was deprecated in 20017 Update 2. The lack of true JSON support and HMAC generation is making it di...
by cstevens
Wed Nov 15, 2017 5:19 pm
Forum: Flows
Topic: Extracting data from xml
Replies: 6
Views: 12558

Re: Extracting data from xml

You've got an extra closing tag at the end of your for-each opening tag:

Code: Select all

<xsl:for-each select="product"/>
should be:

Code: Select all

<xsl:for-each select="product">
If you get rid of that it should be valid.
by cstevens
Fri Nov 10, 2017 6:32 pm
Forum: Flows
Topic: Extracting data from xml
Replies: 6
Views: 12558

Re: Extracting data from xml

It would probably be easier to add product name values to an array like this: var xmlDoc = new Document(job.getPath()); var jobId = xmlDoc.evalToString("//job/id"); s.log(1, "JobID is: " + jobId); var productNames = xmlDoc.evalToNodes("//job/products/product/name"); var...
by cstevens
Fri Nov 10, 2017 6:17 pm
Forum: Flows
Topic: Extracting data from xml
Replies: 6
Views: 12558

Re: Extracting data from xml

How do you want the information saved? Do you want a new XML file with just that information in it, or are you trying to pull it into a script for use elsewhere? If you want a new XML file then an xsl transform is probably the easiest option. If the later then you can do something like this: var xml...
by cstevens
Wed Nov 08, 2017 7:17 pm
Forum: LEGACY scripting
Topic: replacechild
Replies: 9
Views: 17147

Re: replacechild

I'm not sure about his, but I think this is because you're using the same node to replace each of the 3 existing nodes, which effectively is moving the node to the last replacement you do. I think if you move the Node definition element inside your for loop then it will create a new node each time t...
by cstevens
Tue Nov 07, 2017 6:02 pm
Forum: LEGACY scripting
Topic: replacechild
Replies: 9
Views: 17147

Re: replacechild

I think this line is incorrect as well: nodeByPath.at(i).replaceChild(Node, nodeByPath); nodeByPath appears to be a NodeList, and the second parameter in the replaceChild function is expecting a Node. I think it needs to look something like this: nodeByPath.at(i).replaceChild(Node, nodeByPath.at(i)....
by cstevens
Sat Oct 21, 2017 12:58 am
Forum: LEGACY scripting
Topic: JDF/JMF Translator
Replies: 3
Views: 10466

Re: JDF/JMF Translator

What I did for the JDF configurator may not be the best for your application, but here are my recommendations: I recommend using property values in your scripts to populate the various fields you are sending to each press. Then you can use Switch's built-in XML/JDF pickups and path builder to do the...
by cstevens
Mon Oct 16, 2017 9:22 pm
Forum: Flows
Topic: XPATH formatting question
Replies: 9
Views: 146024

Re: XPATH formatting question

Basically you need to open the XML file as a document, then use an evaluation function to return the nodes: Something like this: var inXML = new Document(job.getPath()); var nodeList = inXML.evalToNodes("//PreflightResultEntry[@level='warning']", null); for (var i=0; i<nodeList.length; i++...
by cstevens
Mon Oct 16, 2017 6:30 pm
Forum: Flows
Topic: XPATH formatting question
Replies: 9
Views: 146024

Re: XPATH formatting question

This might be a limitation with Switch's implementation for variables. With the scripting module you can easily return multiple nodes found by an XPath and then loop through them to do formatting or whatever else, but in the variable GUI I was getting warnings that paths selecting multiple nodes wer...