Injecting Switch Backing Files
Posted: Tue Jun 21, 2016 9:34 pm
Introduction
You can inject backing and configuration files from Switch itself, and process those in your flows. Those backing files can easily be converted into datasets with an XML pickup, which you can use to pull out information. This could be pretty dangerous if you set up this inject improperly, so don't try this if you don't know what you're doing.
In this example flow, I've created a system which updates an image with some general status information.

Below is the result:

It should update every 5 minutes or so if you check back later.
Explanation
The "Dummy Job Clock" is a simple timerFired script which I'm using to drive my Injects. Every 5 minutes, it sends a dummy job into two Injects. The two Injects pull out copies of the flow and settings backing files. The flows are counted and then that count is written to private data. The settings are parsed as a dataset where the Switch major version is saved to private data. The contents are assembled, then move into a portal for better readability. Out of the portal, the job goes into a simple script which passes a text string to a Node script which creates an image from the text string. The image is then uploaded to AWS S3, overwriting the old object.
Download
Flow: https://drive.google.com/file/d/0B9ciRz ... sp=sharing
Flow Documentation: https://www.googledrive.com/host/0B9ciR ... WlSaGZkRW8
Conclusion
Switch is very open, in more ways than one. It's a very powerful tool and it makes it possible to create some solid automation without having to deal with serious programmers. But as time goes on, I find myself using more and more of my own tools which I'm developing. Because I have these tools now, it makes something like this trivial to put together. We could all make our tools in our own little bubbles, and in some cases, we need to. But all of our collective lives would be so much easier if we worked together, on a common set of scripts and practices that we can all re-use and improve upon. We would all be in a better place if more print automation folks contributed to the open source community.
What was used
Signature generator and script: https://github.com/dominickp/switch-sig
Private data script: https://github.com/open-automation/Swit ... rivateData
Dummy job clock script: https://github.com/open-automation/DummyJobClock
Portals: https://github.com/open-automation/SwitchPortals
SwitchAWS: https://github.com/open-automation/SwitchAWS
You can inject backing and configuration files from Switch itself, and process those in your flows. Those backing files can easily be converted into datasets with an XML pickup, which you can use to pull out information. This could be pretty dangerous if you set up this inject improperly, so don't try this if you don't know what you're doing.
In this example flow, I've created a system which updates an image with some general status information.

Below is the result:

It should update every 5 minutes or so if you check back later.
Explanation
The "Dummy Job Clock" is a simple timerFired script which I'm using to drive my Injects. Every 5 minutes, it sends a dummy job into two Injects. The two Injects pull out copies of the flow and settings backing files. The flows are counted and then that count is written to private data. The settings are parsed as a dataset where the Switch major version is saved to private data. The contents are assembled, then move into a portal for better readability. Out of the portal, the job goes into a simple script which passes a text string to a Node script which creates an image from the text string. The image is then uploaded to AWS S3, overwriting the old object.
Download
Flow: https://drive.google.com/file/d/0B9ciRz ... sp=sharing
Flow Documentation: https://www.googledrive.com/host/0B9ciR ... WlSaGZkRW8
Conclusion
Switch is very open, in more ways than one. It's a very powerful tool and it makes it possible to create some solid automation without having to deal with serious programmers. But as time goes on, I find myself using more and more of my own tools which I'm developing. Because I have these tools now, it makes something like this trivial to put together. We could all make our tools in our own little bubbles, and in some cases, we need to. But all of our collective lives would be so much easier if we worked together, on a common set of scripts and practices that we can all re-use and improve upon. We would all be in a better place if more print automation folks contributed to the open source community.
What was used
Signature generator and script: https://github.com/dominickp/switch-sig
Private data script: https://github.com/open-automation/Swit ... rivateData
Dummy job clock script: https://github.com/open-automation/DummyJobClock
Portals: https://github.com/open-automation/SwitchPortals
SwitchAWS: https://github.com/open-automation/SwitchAWS