Changing version inside a project using batch file

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Post Reply
Ian Kowalsky
Posts: 2
Joined: Wed Aug 14, 2019 2:40 pm

Changing version inside a project using batch file

Unread post by Ian Kowalsky »

Hi.
I'm using a batch file to publish pdf versions of few dozens documents at once and it works brilliantly. I was wondering though if it is possible to change and save major/minor/build version numbers inside a project (configuration -> common properties -> title & copyright tab) with some kind of batch/console command. /V= command seems to only be working during publishing proccess, while the project itself remains unchanged.
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Changing version inside a project using batch file

Unread post by Tim Green »

Hi Ian,

The changes you can make via batch only work on the output, never on the project itself. If you need changes in the project you need to make them in the project. :?
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
Ian Kowalsky
Posts: 2
Joined: Wed Aug 14, 2019 2:40 pm

Re: Changing version inside a project using batch file

Unread post by Ian Kowalsky »

Tim Green wrote:Hi Ian,

The changes you can make via batch only work on the output, never on the project itself. If you need changes in the project you need to make them in the project. :?
I see, thanks.
Perhaps there is some way to automate this proccess (modifying many projects at once)?
User avatar
Tim Green
Site Admin
Posts: 23156
Joined: Mon Jun 24, 2002 9:11 am
Location: Bruehl, Germany
Contact:

Re: Changing version inside a project using batch file

Unread post by Tim Green »

Perhaps there is some way to automate this proccess (modifying many projects at once)?
For that to be possible the projects would need to be stored in the uncompressed XML (HMXP instead of HMXZ) format (which you should be using anyway for ongoing work because it is safer, more secure and more efficient). Then you can use a multi-file search and replace tool to replace the settings you want to change in the .hmxp project file. You would just need to search and replace the values in these three tags inside the .hmxp file, which is a normal XML file:

Code: Select all

<config-value name="versionmajor">1</config-value>
<config-value name="versionminor">0</config-value>
<config-value name="versionbuild">0</config-value>
If you don't have a suitable editor for this here's a list of some good ones you could use:

Notepad++ (free):
http://notepad-plus-plus.org/

Notepad++ also supports multi-file regular expression searching, if you feel comfortable with that, but it is more limited than PowerGREP but its search and replace is fine for this kind of task. It is also one of the best code editors available, at any price. I use it for all my web programming.

FAR HTML (inexpensive, generous free trial period)
http://www.helpwaregroup.com/products/far

FAR HTML is actually a Swiss Army knife for help authors, with a wealth of useful tools, not just the find and replace. It includes a special interface for complex searches, making them easier for users not familiar with the rather arcane syntax of regular expressions.

PowerGREP:
http://www.powergrep.com/

If you feel comfortable with regular expressions PowerGREP is the best tool available, on any platform and at any price. It is a little pricey, but if you do a lot complex searching in multiple files (also for programming work) it will pay for itself subjectively in a single afternoon. The RegexBuddy tool from the same company (http://www.regexbuddy.com/) is also the best interactive tool available for defining and testing regular expressions, and its documentation is quite literally the best tutorial and introduction to regular expressions available anywhere.

Windows Grep (less expensive and also less powerful than PowerGREP)
http://www.wingrep.com/index.htm

IMPORTANT: Always make a backup before doing this! Automated global changes are always risky. ;-)
Regards,
Tim (EC Software Documentation & User Support)

Private support:
Please do not email or PM me with private support requests -- post to the forum directly.
User avatar
julio
Posts: 118
Joined: Wed May 28, 2008 12:06 am
Location: Porto Alegre, RS - Brasil
Contact:

Re: Changing version inside a project using batch file

Unread post by julio »

Do you really need to change the project after creating its output? I ask that because we use the /V parameter to create outputs using version numbers from a specific build of a product, so the project's version numbers are irrelevant because that product is inside a version control system (TFS) that automatically increments those numbers for each build. I used to change those <%VERSION_MAJOR%>, <%VERSION_MINOR%>, and <%VERSION_BUILD%> variables manually after every product branch on TFS and that was a painful task (almost 70 outputs).
Ian Kowalsky wrote:
Tim Green wrote:Hi Ian,

The changes you can make via batch only work on the output, never on the project itself. If you need changes in the project you need to make them in the project. :?
I see, thanks.
Perhaps there is some way to automate this proccess (modifying many projects at once)?
Post Reply