Create file from template

Download for free
Get it now

What if you want to create a relatively complex text file in Switch? Say… something like an XML file, or a JDF, or a complex JSON file. Yes, you can write a custom script for this, but even with a script, doing this is still very messy and a lot of hard and painstaking work. If only there would be a way to make that easier…

Wait a minute, when you’re generating HTML files for a web site, isn’t that very much the same problem? How do those systems deal with that? Turns out that smart people invented something called a templating engine. You provide a template and can then insert variables in that template in a structured way. Modern templating engines even allow you to create loops, insert conditionals and so on.

This Switch app uses a templating engine – Embedded JavaScript templating, or EJS – to do exactly this. The app has different ways to specify where the template is and to specify input variables for the template. It builds the output from the template injected with these variables and then outputs it according to what you need in the rest of the workflow.

What can you do with this?

The sky is the limit! :) However, some practical examples would be:

  • Insert private data (and other metadata from a job) into a template to generate a text or HTML email body.
  • Use an incoming JSON file with information about an order and generate a production follow-up email for it.
  • Create a JDF template and insert job information for output to an output device or production workflow.
  • Write log information to a CSV file (yes, the app supports appending to an existing file).
  • Output a JSON, XML,... file to communicate with an external service.

Can't I do this with a script?

Of course you can write a custom script for this (well, if you have access to the scripting module that is). But scripts to write complex text files very quickly become messy. Using this app has the advantage that you separate the business logic from the presentation. Use a script to attach information to a job, or to generate a custom JSON file. Then use this app and a custom template to format your information into the output format you want. Doing things this way both your script and the template become simpler and are more easily maintainable.

I need this but it's too complicated for me

Yes, we also have things we find complex and we rather have someone else do for us. This app and the templates it uses we do understand quite well. So get in contact with us and see how we can help you to prepare the template you need (or any other problem you're trying to solve using Switch).


Switch Version Required: 2020 Fall or higher
Platform: Windows, Mac
3rd Party Compatibility:    
Yves B. (France) installed this app.
Reviewed on 22 Sep 2022.

This is a great app that makes it easy for me to generate jdf's on the fly, huge possibilities for a very easy to use app.

App creator

Four Pees
+32 9 237 10 00
Online support

App creator

Four Pees
+32 9 237 10 00
Online support