Python Scripts
You can also use Python for scripting of HippoEDIT. It is not so straightforward as with JavaScript or VB Script but still possible.
To start writing your tool or service scripts in Python, you need to do following steps:
- Install Python. There are at least two installations of Python available. Official one, that can be downloaded from python.org or ActivePython installation (free Community Edition) from ActiveState web site. Download one fitting your version of Windows and your HippoEDIT architecture (you need x64 bit version for HippoEDIT x64) and install it. Now you can execute python scripts.
- Install Python for Windows extensions. To be able to use Python for application scripting (with Active Scripting technology), you need to install Python for Windows extensions from GitHub project page. Select the latest build and download extension version corresponding to the version of Python you have installed (for example pywin32-223.win-amd64-py3.6.exe). Install it, agree on everything.
- Register Python as Scripting Engine. After installation of the extension, in Python folder (for example C:\Users\<user_name>\AppData\Local\Programs\Python\Python36\ ) find file \lib\site-packages\win32comext\axscript\client\pyscript.py and execute it by double-clicking. It shall result in UAC prompt (agree on it) and output like “Registered: Python”.
- If all went fine, now you are able to run/write Python scripts/plug-ins in HippoEDIT.
As test, try to execute following file in HippoEDIT:
- test.pys
alert("Hello HippoEDIT!")
Known issues
There are some differences in Python implementation of Active Scripting engine, that shall be taken into account.
Default Application object
Be aware that Python is more sensible to object definitions as other languages, so it is better to add default global Application objects before accessing of properties. For example use Application.WScript instead of just WScript.
Include and Imports
Looks like Python implementation does not support modules in other languages to be inserted into global scope… So, you can not use HE functions for including/importing of files (as include/import directives or include/import commands). But fortunately, Python has his own functions for python module including.
This limitation is also result that HippoEDIT constants (like eMessageTypeInfo), defined in file <UserDirectory>/scripts/he_constants.js, which are normally included in the scope are not recognized . So, just redefine them in your Python file, coping from he_constants.js. It is very unlikely that they will be changed.