05-24-2012, 12:40 PM
Python can be embedded in QM like in C/C++. It is documented in ActivePython documentation.
Other way - active scripting. Easier. Copy QM function VbsExec and similar functions and edit for Python. Example:
Function PythonExec
I tested with ActivePython 2.7: http://www.activestate.com/activepython/downloads
Initially did not work. Need to install Python for Windows Extensions (PyWin32) from sourceforge. Also may need to run C:\YourPythonVersion\Lib\site-packages\win32comext\axscript\client\pyscript.py.
Other way - active scripting. Easier. Copy QM function VbsExec and similar functions and edit for Python. Example:
Function PythonExec
;/
function $code [flags] ;;flags: 0 text, 1 macro, 2 file, 4 skip first line in macro.
;Executes Python code.
;EXAMPLE
;str code=
;;python code
;;python code
;PythonExec code
#if EXE
#warning __ME_W2
#endif
MSScript.ScriptControl- _python
VbsInit2 _python "Python" code flags _s; err end _error
_python.ExecuteStatement(code); err end _error
if(_python.Error.Number) end VbsError(_python)I tested with ActivePython 2.7: http://www.activestate.com/activepython/downloads
Initially did not work. Need to install Python for Windows Extensions (PyWin32) from sourceforge. Also may need to run C:\YourPythonVersion\Lib\site-packages\win32comext\axscript\client\pyscript.py.
