Python3 solution
I have a workaround.
I have a working Python3 script now (written and tested on Python 3.4). It can be executed with a single filename and it will try to determine what kind of file it is and handle it appropriately. Each of these possibilities is tried, in order, until one succeeds.
- Filename ends with .por or .zip: treated as a HeroLab portfolio file. The script will look inside and pull out the filenames of the heroes, then process each one in the same order that they appear in the portfolio.
- Filename is equal to "portfolio.xml": treated as though the portfolio has already been extracted (as a ZIP file) and the script is being executed in the top-level directory where it was unpacked. It will search the current directory and the herolab/ subdirectory looking for portfolio.xml. if it finds it, it will look for the heroes listed within and process them the same as the previous choice.
- Filename ends with .xml: treated as a simple data file that contains the information for a single hero. The journal will be extracted from only this file. The current directory will be searched and if the file is not found, the herolab/ subdirectory will also be searched.
If none of the above match, a general message is displayed that describes how to use the script.
Obviously, you will need Python 3.4+ installed for this script to work. In the future I will create a generic Python module that can be used to access HL portfolio files. This will allow faster creation of similar scripts when the need arises.
In most GUI environments the user should be able to drag/drop a HeroLab portfolio file on top of the script and the GUI will execute the script and pass it the portfolio's filename as a parameter. This will activate option #1 in the list above. (This isn't working on my Mac and I haven't started looking into it yet, but other GUIs I'm familiar with will work as described.)
(Note: the forum software won't let me name my Python script with the typical
.py extension, so I've named it with
.txt instead. You'll need to change the filename extension after downloading it.)
I have subscribed to this thread, so if you have comments or ideas for things to add, let me know and I'll work on them when I can.