From 8b2f772721edfc4caa1d1de558f2f030b4ea1b57 Mon Sep 17 00:00:00 2001 From: ScadeBlock <89845150+ScadeBlock@users.noreply.github.com> Date: Wed, 2 Aug 2023 13:26:48 +0700 Subject: [PATCH] Update README.md --- README.md | 53 +++++++++++++++++++++-------------------------------- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 94bc6dd..b928c9f 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,17 @@ # PythonWIMVBA > Python With VBA ! Run python via VBA --- -**✨✨ New on PythonWimVBA 5.3 ✨✨** -+ Added multiple threads (Run multiple RunPy functions) -+ Improve function, add new `newengine` -+ Enhanced PyWimVBA performance -+ Keeps the old PyWimVBA function (In version 5.2) and renames it to `RunPyOld` -- ~~Add new `RunPyWid()` - with `showcmd=True` function doesn't need to create file~~ (Removed!) +# **🖥 PyWimVBA 6.0! - New release! ⚔** +> New features, with many changes from 5.x +### 🎉🎉**New Features**🎉🎉 +- Create new RunPy + - Require `PyServer` (1.0 for PyWVBA 6.0) + - Added cache value + - Huge Performance improves from 5.x ++ Added some server function like `ClearPyServer()` - Clear all variable cached ++ Don't need to create logfile or codefile ++ Keep 5.4 `RunPy()` and renamed it to `RunPyOld()` ++ ⚠ Warning: `PyServer 1.0` using localhost with port : `9812` # Where's the lower version of PythonWimVBA? > **Lower Version is tested privately; some versions are publicly released, but they are pre-release. They're outdated, unsecure and unstable, so please use only versions 5.2 or above**. @@ -14,9 +19,15 @@ + Install python (Any version, NOTE: Checks Add python to path when start setup) + Install PyWimVBA to your vba project (Install .bas file and see [here](https://support.tetcos.com/support/solutions/articles/14000143233-how-to-import-vba-script-bas-file-in-ms-excel-) ) -# Usage -**Command:** ``LoadPy(file,[iline = False])`` -+ Load a python file and convert it to PyWimVBA Syntax +# 🎨 PyWimVBA Example +### Example usage +#### 💎PyWimVBA 6.0 New Function ++ `StartPyServer(Optional: pythonPath = "python",Optional useCustomPyServer: False,Optional : silent=false)` : Starts **`PyServer`** (PyServer supports only single server) `silent=true` will hide command prompt of `PyServer`. Set `useCustomPyServer` to path of your PyServer (can use in offline or a older pyserver) ++ `EndPyServer(Optional deletePyServer: True)` - A server doesn't close automatically with VBA, so you need to close it before end VBA code . Use `deletePyServer=False` to keep your PyServer to reuse in `StartPyServer` (Not recommend) ++ `CheckPyServer()` - Check a or any server is running. ++ `ClearPyServer()` - Because `PyServer` support only one server, you can use this function to clear cached data like value,etc... ++ `RunPy(code)` - Simply run a code of python, split new line with `;;` ++ ``LoadPy(file,[iline = False])`` - Load a python file and convert it to PyWimVBA Syntax - For example, it'll convert this file code `examplefile.py` @@ -28,32 +39,10 @@ - To `import time;time.sleep(5)` - APPLY TO USE: `RunPy(LoadPy("mycodefile.anyextension"))` -**Command:** ``RunPy(code,[pythonPath = "python"] , [newengine = False], [ keepFileData = False] , [UseDebug = False])`` ++ ``RunPyOld(code,[pythonPath = "python"] , [newengine = False], [ keepFileData = False] , [UseDebug = False])`` + Code splitting by ";;" , e.x : `import time;;time.sleep(5)` + [Optional] newengine : Improve performance, doesn't need to create logfile - still create code file . But it's will show up a cmd splash - doesn't work with UseDebug + [Optional] keepFileData: Keep the output file and code file after finishing execution. + [Optional] UseDebug: Show cmd that runs python code and keep it alive with it's output [Use debug to catch errors, the output file may not catch them. So when debug is enabled, Output file does nothing. + E.x : `MsgBox RunPy("Welcome to \'Python With VBA!\'")` -> In lastest fix, Remove RunPyOld, RunPyWid (Issued and Too Unstable) - -**Command:** `RunPyWid(code, [pythonPath = "python"], [showcmd = True], [iline = False], [UseDebug =False])` -+ Code splitting by ";;" , e.x : `import time;;time.sleep(5)` -+ With `showcmd=True` performance will be better than `showcmd=False` (because of `showcmd=False` must create logfile to catch log, `showcmd=True` mustn't) -- **[Optional OR Compulsory]iline** - - `Iline` attributes convert code from - - `import time` - - `time.sleep(2)` - - To `exec("import time\ntime.sleep(2)")` - - (convert multiple line to single line) -+ :warning: `Iline` is custom with `showcmd=True` but it's must for `showcmd=False` -+ [Optional] UseDebug: Show-up cmd that runs python code, keep it alive with it's output [Use debug to catch errors, Output file may not catch them. Only works with `showcmd=False`] -- New release (Unstable!) - - Aready know bugs : Syntax error (Error with `\"` and `\'` in string python, e.x: `RunPyWid("print('This function failed with \'')")` , ) - -**Command:** ``RunPyOld(code,pythonPath, [ keepFileData = False] , [UseDebug = False])`` -+ Code splitting by ";;" , e.x : `import time;;time.sleep(5)` -+ [Optional] keepFileData: Keep the output file and code file after finishing execution. -+ [Optional] UseDebug: Show cmd that runs python code and keep it alive with it's output [Use debug to catch errors, the output file may not catch them. So when debug is enabled, Output file does nothing. - -