|
1 | 1 | # PythonWIMVBA
|
2 | 2 | > Python With VBA ! Run python via VBA
|
3 | 3 | ---
|
4 |
| -**✨✨ New on PythonWimVBA 5.3 ✨✨** |
5 |
| -+ Added multiple threads (Run multiple RunPy functions) |
6 |
| -+ Improve function, add new `newengine` |
7 |
| -+ Enhanced PyWimVBA performance |
8 |
| -+ Keeps the old PyWimVBA function (In version 5.2) and renames it to `RunPyOld` |
9 |
| -- ~~Add new `RunPyWid()` - with `showcmd=True` function doesn't need to create file~~ (Removed!) |
| 4 | +# **🖥 PyWimVBA 6.0! - New release! ⚔** |
| 5 | +> New features, with many changes from 5.x |
| 6 | +### 🎉🎉**New Features**🎉🎉 |
| 7 | +- Create new RunPy |
| 8 | + - Require `PyServer` (1.0 for PyWVBA 6.0) |
| 9 | + - Added cache value |
| 10 | + - Huge Performance improves from 5.x |
| 11 | ++ Added some server function like `ClearPyServer()` - Clear all variable cached |
| 12 | ++ Don't need to create logfile or codefile |
| 13 | ++ Keep 5.4 `RunPy()` and renamed it to `RunPyOld()` |
| 14 | ++ ⚠ Warning: `PyServer 1.0` using localhost with port : `9812` |
10 | 15 | # Where's the lower version of PythonWimVBA?
|
11 | 16 | > **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**.
|
12 | 17 |
|
13 | 18 | # Installation
|
14 | 19 | + Install python (Any version, NOTE: Checks Add python to path when start setup)
|
15 | 20 | + 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-) )
|
16 | 21 |
|
17 |
| -# Usage |
18 |
| -**Command:** ``LoadPy(file,[iline = False])`` |
19 |
| -+ Load a python file and convert it to PyWimVBA Syntax |
| 22 | +# 🎨 PyWimVBA Example |
| 23 | +### Example usage |
| 24 | +#### 💎PyWimVBA 6.0 New Function |
| 25 | ++ `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) |
| 26 | ++ `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) |
| 27 | ++ `CheckPyServer()` - Check a or any server is running. |
| 28 | ++ `ClearPyServer()` - Because `PyServer` support only one server, you can use this function to clear cached data like value,etc... |
| 29 | ++ `RunPy(code)` - Simply run a code of python, split new line with `;;` |
| 30 | ++ ``LoadPy(file,[iline = False])`` - Load a python file and convert it to PyWimVBA Syntax |
20 | 31 | - For example, it'll convert this file code
|
21 | 32 |
|
22 | 33 | `examplefile.py`
|
|
28 | 39 | - To `import time;time.sleep(5)`
|
29 | 40 | - APPLY TO USE: `RunPy(LoadPy("mycodefile.anyextension"))`
|
30 | 41 |
|
31 |
| -**Command:** ``RunPy(code,[pythonPath = "python"] , [newengine = False], [ keepFileData = False] , [UseDebug = False])`` |
| 42 | ++ ``RunPyOld(code,[pythonPath = "python"] , [newengine = False], [ keepFileData = False] , [UseDebug = False])`` |
32 | 43 | + Code splitting by ";;" , e.x : `import time;;time.sleep(5)`
|
33 | 44 | + [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
|
34 | 45 | + [Optional] keepFileData: Keep the output file and code file after finishing execution.
|
35 | 46 | + [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.
|
36 | 47 | + E.x : `MsgBox RunPy("Welcome to \'Python With VBA!\'")`
|
37 | 48 |
|
38 |
| -> In lastest fix, Remove RunPyOld, RunPyWid (Issued and Too Unstable) |
39 |
| -
|
40 |
| -**Command:** `RunPyWid(code, [pythonPath = "python"], [showcmd = True], [iline = False], [UseDebug =False])` |
41 |
| -+ Code splitting by ";;" , e.x : `import time;;time.sleep(5)` |
42 |
| -+ With `showcmd=True` performance will be better than `showcmd=False` (because of `showcmd=False` must create logfile to catch log, `showcmd=True` mustn't) |
43 |
| -- **[Optional OR Compulsory]iline** |
44 |
| - - `Iline` attributes convert code from |
45 |
| - - `import time` |
46 |
| - - `time.sleep(2)` |
47 |
| - - To `exec("import time\ntime.sleep(2)")` |
48 |
| - - (convert multiple line to single line) |
49 |
| -+ :warning: `Iline` is custom with `showcmd=True` but it's must for `showcmd=False` |
50 |
| -+ [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`] |
51 |
| -- New release (Unstable!) |
52 |
| - - Aready know bugs : Syntax error (Error with `\"` and `\'` in string python, e.x: `RunPyWid("print('This function failed with \'')")` , ) |
53 |
| - |
54 |
| -**Command:** ``RunPyOld(code,pythonPath, [ keepFileData = False] , [UseDebug = False])`` |
55 |
| -+ Code splitting by ";;" , e.x : `import time;;time.sleep(5)` |
56 |
| -+ [Optional] keepFileData: Keep the output file and code file after finishing execution. |
57 |
| -+ [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. |
58 |
| - |
59 |
| - |
0 commit comments