Using Python as an optional scripting language instead of VB script. #449
-
Hi, I currently use VBscript as a scripting language which works quite well as I can expose my apps API to the scripts via type libraries and I am confused how to fit python into the same scripting paradigm. Currently I can load load several scripts into my script objects, instantiate VBscript interpreters for each one, run main functions to initialise them and then the functions become available for my app to use. When I edit a script, I can reset the script interpreter, send it the new code and reinitialise it. I can't seem to do this with python as it only allows 1 interpreter to run in the same process. Is there a way to fit Python within this paradigm? Should I use 1 interpreter with a hidden main script and make my effective scripts as modules? The scripts don't need to run concurrently and they need to be in the same process. Also my end users may not want to install python or use python scripts, so can I still use the design time components or will they cause errors if no python distro is installed? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
For a popular application that uses python as a scripting language using P4D, have a look at https://github.com/Alexey-T/CudaText |
Beta Was this translation helpful? Give feedback.
-
Thanks, when you say... "You do need a separate interpreter for each script." do you mean, did you miss out the "not" ? |
Beta Was this translation helpful? Give feedback.
I do not know what your VB scripts are doing, but most likely you need to convert them to python code (not necessarily a module) and use one of the ExecStrings methods to run them. Before doing any work, it is worth watching the tutorials and playing with some of the demos.