Search found 106 matches

by cstevens
Tue Feb 11, 2025 1:56 am
Forum: Flows
Topic: XPath expression issue
Replies: 7
Views: 32216

Re: XPath expression issue

Wouldn't the XPath for that just be //JobGang/JobID/@text ?
by cstevens
Thu Sep 12, 2024 10:57 pm
Forum: Node.js scripting
Topic: node.js debugger setup
Replies: 6
Views: 26771

Re: node.js debugger setup

Also I see my switch-scripting module is a bit out of date: "node_modules/@types/switch-scripting": { "version": "22.1.0", "resolved": "https://github.com/enfocus-switch/types-switch-scripting/archive/22.1.0.tar.gz", "integrity": "sha5...
by cstevens
Thu Sep 12, 2024 10:54 pm
Forum: Node.js scripting
Topic: node.js debugger setup
Replies: 6
Views: 26771

Re: node.js debugger setup

I think something got messed up with my attach configuration, none of the variables appear and the debugger doesn't hit any of my break points. I re-watched all the learning path videos, but nothing goes into detail on how this should be configured. This used to work, but I think I developed the scr...
by cstevens
Tue Mar 12, 2024 6:43 pm
Forum: LEGACY scripting
Topic: Adding multiple namespaces to xml root
Replies: 2
Views: 13757

Re: Adding multiple namespaces to xml root

Yes you can. Are you reading in that XML, or generating it from scratch? It's been a while, but I believe you use createEmptyMap() function to create new namespaces, then any new elements you generate with createElement() should reference the appropriate namespace name you want to use. If you're rea...
by cstevens
Wed Jan 10, 2024 11:34 pm
Forum: Node.js scripting
Topic: NPM package for generating XML
Replies: 3
Views: 69478

Re: NPM package for generating XML

After some additional searching xmlbuilder2 https://github.com/oozcitak/xmlbuilder2 looks promising. Not sure if anyone else has any experience working with it.
by cstevens
Wed Jan 10, 2024 9:39 pm
Forum: Node.js scripting
Topic: NPM package for generating XML
Replies: 3
Views: 69478

NPM package for generating XML

Can anyone recommend an NPM package that can be used to create/modify complex XML? This is for JDF workflows, so I need to handle multiple namespaces, partitioned child elements etc. All of the libraries I can find seem to be focused primarily on XML parsing, with limited generation capabilities.
by cstevens
Thu Dec 10, 2020 11:26 pm
Forum: LEGACY scripting
Topic: Merge two text files
Replies: 2
Views: 10489

Re: Merge two text files

If you can group all the text files together beforehand (using assemble job or something) and provide a folder containing all the files to the script then it would look something like this: //Create a Directory object for the incoming folder var inFolder = new Dir(job.getPath()); //Get the list of t...
by cstevens
Wed Jun 10, 2020 10:23 pm
Forum: Node.js scripting
Topic: New scripting engine in Switch 2020
Replies: 10
Views: 40441

Re: New scripting engine in Switch 2020

Great presentation. I'm also looking forward to using this. Your description of the await operator actually cleared up a lot of confusion for me.
by cstevens
Fri May 22, 2020 5:41 pm
Forum: Applications
Topic: Variable Data and Switch
Replies: 3
Views: 11918

Re: Variable Data and Switch

You might want to look into the new PrintOS Cloud-based composer app in the app store https://www.enfocus.com/en/appstore/product/hp-printos-composer . The app handles transfer of components to/from the cloud. Since processing is done in the cloud you're not limited to a single thread with the InDes...
by cstevens
Tue Jan 14, 2020 11:39 pm
Forum: Flows
Topic: Assemble Jobs Based on Total Page Count
Replies: 5
Views: 11887

Re: Assemble Jobs Based on Total Page Count

There's probably a more elegant way to handle this with the rename element and the assemble job element using the Stats.NumberOfPages variable, but I can't figure it out. In scripting you could do something like this: //set some scope that makes sense for your application var scope = s.getElementUni...
by cstevens
Thu Dec 05, 2019 11:20 pm
Forum: LEGACY scripting
Topic: job.getPath() can't find the file
Replies: 6
Views: 14272

Re: job.getPath() can't find the file

Try entering "cmd /c " before "java ..."
by cstevens
Fri Oct 11, 2019 6:47 pm
Forum: LEGACY scripting
Topic: Javascript help
Replies: 1
Views: 8286

Re: Javascript help

I don't believe there's any support for external dependencies in Switch's scripting interface. You'll need to use the built-in HTTP Client:

https://www.enfocus.com/manuals/Develop ... class.html
by cstevens
Thu Sep 26, 2019 4:04 pm
Forum: LEGACY scripting
Topic: Add Attribute to XML, with a twist.
Replies: 12
Views: 46363

Re: Add Attribute to XML, with a twist.

Sorry, I must have accidentally unsubscribed to this thread. Sorry to leave you hanging like that. Looks like you got it working though.
by cstevens
Fri Sep 13, 2019 10:58 pm
Forum: LEGACY scripting
Topic: Add Attribute to XML, with a twist.
Replies: 12
Views: 46363

Re: Add Attribute to XML, with a twist.

So is the original XML file coming into the script? This should still be valid, you just need to change the paths to the original xml file (job.getPath()), the xml folder repository location, and the XPath where the jobnumber is located within the xml file(s) in the repository. Is the ISBN number in...
by cstevens
Fri Sep 13, 2019 9:46 pm
Forum: LEGACY scripting
Topic: Add Attribute to XML, with a twist.
Replies: 12
Views: 46363

Re: Add Attribute to XML, with a twist.

Edit. I misread your post originally, this is updated to reflect more what you wanted. Something like this maybe? I don't know what the structure of the XML file you're searching for the job number is, or which if the xml files is triggering the script. I'm assuming (probably incorrectly) that the f...