Use a batch file to simplify OpenTBS templatingThis is for Windows users working with Word templates (who have or can get 7-zip or another command line zip interface).
If you have a complicated or fragile template like I do (saving my .docx in Word would destroy almost all of my TBS tags), you may find yourself repeatedly changing the file extension of your .docx to .zip, going in, copying out the document.xml, editing it, saving it, copying it back into the .zip archive, and changing the extension back to .docx. This is error prone and slow and annoying but as I have gotten steady sicker of it, I have decided on some things that make it easier.
First, I keep a perfect copy of my .docx that has been changed to .zip and unzipped as a folder. This speeds it up and allows you to edit document.xml easily without risking overwriting another document.xml accidentally. I keep this folder with my OriginalFileName.docx. so it looks like this:
Then I wrote a batch file that does the annoying stuff for me. I just edit MyProject/OriginalFileName/word/document.xml and run copy-document-xml.bat which (for me) looks like:
This changes to the drive letter I want and then changes directories until it arrives in MyProject location (this may not be necessary for you, I am working from a network drive and can't accept UNC paths as a cmd starting point...). You can take out the first two lines if when your bat runs, it starts in the current folder.
Then it copies the document.xml you edited to the right level of hierarchy to fit into your docx.
It renames the .docx to .zip so you can interact with it with 7-zip.
Next you will need to include the path to your command line zip interface (you can see mine in the quotes). If you use 7-zip, the 'a' means add to archive. If you use something else, you will need to look at their documentation.
Finally it renames the zip archive (your template in disguise) back to its original name and extension.
If you upload your template somewhere, you could add an ftp command to this file and really reduce friction.
Most people probably won't need this, but I made it earlier today and it has already saved me a ton of time and annoyance (as well as probably prevented some errors!) so I thought it might be worth sharing.
Thanks for reading, hope it helps.
Re: Use a batch file to simplify OpenTBS templatingThanks for sharing this tip.
By the way, OpenTBS is based on a PHP class that is able to manage ZIP archive un full PHP.
This can give ideas to build your batch above in PHP (if have it in PHP may have any utility, which is not sure).