Releases: ScadeBlock/PythonWIMVBA
PyWimVBA 6.0 Alpha
🎉🎉New Features🎉🎉
- Create new RunPy
- Require
PyServer
(1.0 for PyWVBA 6.0) - Added cache value
- Huge Performance improves from 5.x
- Require
- 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 toRunPyOld()
- ⚠ Warning:
PyServer 1.0
using localhost with port :9812
🎨 PyWimVBA Example
Documention
💎PyWimVBA 6.0 New Function
-
StartPyServer(Optional: pythonPath = "python",Optional useCustomPyServer: False,Optional : silent=false)
: StartsPyServer
(PyServer supports only single server)silent=true
will hide command prompt ofPyServer
. SetuseCustomPyServer
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 . UsedeletePyServer=False
to keep your PyServer to reuse inStartPyServer
(Not recommend) -
CheckPyServer()
- Check a or any server is running. -
PathPyServer()
- Get PyServer path -
ClearPyServer()
- BecausePyServer
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;;
and indentation are space,tab or tab smart syntax:!tab~
-
LoadPy(file)
- Load a python file and convert it to PyWimVBA Syntax- For example, it'll convert this file code
examplefile.py
import time time.sleep(5)
- To
import time;time.sleep(5)
- APPLY TO USE:
RunPy(LoadPy("mycodefile.anyextension"))
-
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!\'")
Example usage
Here's a example code to run python in vba wuth PWV
Sub running()
StartPyServer
RunPy ("example_value = 'Hello from PWA 6!'")
MsgBox RunPy("print(example_value)") 'To test cached value
MsgBox RunPy("if 1+1==2:;;!tab~print('It actually works!')")
EndPyServer
End Sub
PyWimVBA 5.3 Hot Fix!
✨✨ New on PythonWimVBA 5.3 ✨✨
- Added multiple threads (Run multiple RunPy functions)
- Improve function, add new
newengine
- Enhanced PyWimVBA performance
- Hot Fix!
- Remove RunPyWid - Too unstable
- Remove RunPyOld - Issued
Usage
Command: LoadPy(file,[iline = False])
-
Load a python file and convert it to PyWimVBA Syntax
- For example, it'll convert this file code
examplefile.py
import time time.sleep(5)
- To
import time;time.sleep(5)
- APPLY TO USE:
RunPy(LoadPy("mycodefile.anyextension"))
Command: RunPy(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!\'")
PyWimVBA 5.3
✨✨ 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()
- withshowcmd=True
function doesn't need to create file- Remove
keepFileData
attributes and addshowcmd
- Added
iline
attributes
- Remove
Usage
Command: LoadPy(file,[iline = False])
-
Load a python file and convert it to PyWimVBA Syntax
- For example, it'll convert this file code
examplefile.py
import time time.sleep(5)
- To
import time;time.sleep(5)
- APPLY TO USE:
RunPy(LoadPy("mycodefile.anyextension"))
Command: RunPy(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!\'")
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 thanshowcmd=False
(because ofshowcmd=False
must create logfile to catch log,showcmd=True
mustn't)
- [Optional OR Compulsory]iline
Iline
attributes convert code fromimport time
time.sleep(2)
- To
exec("import time\ntime.sleep(2)")
- (convert multiple line to single line)
⚠️ Iline
is custom withshowcmd=True
but it's must forshowcmd=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 \'')")
, )
- Aready know bugs : Syntax error (Error 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.
PyWimVBA 5.2a
✨✨ New on PythonWimVBA 5.2a ✨✨
- Added multiple threads (Run multiple RunPy function)
- Remove output file Path and filename (remove!, Added auto random generate name)
Usage
Command: RunPy(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, keep it alive with it's output [Use debug to catch errors, Output file may not catch them. So when debug is enabled, Output file does nothing.]
PyWimVBA 5.2
✨✨ New on PythonWimVBA 5.2 ✨✨
- Catch All Python Output, so outtl is useless (removed!, don't need on 5.2 or higher version)
- Added UseDebug (show cmd and keep cmd alive with it's output) and keepFileData (keeps pywvout.txt and pywvba.py after execution) attributes
Usage
Command: RunPy(code,pythonPath, [outputFilePath = "pywvout.txt"] , [ filename = "pywvba.py"], [ keepFileData = False] , [UseDebug = False])
- Code splitting by ";;" , e.x :
import time;;time.sleep(5)
- [Optional] Output File Path: File that writes every output of python
- [Optional] File Name: File that contains your code to run
- [Optional] keepFileData: Keep output file and code file after finishing execution.
- [Optional] UseDebug: Show cmd that runs python code, keep it alive with it's output [Use debug to catch errors, Output file may not catch them. So when debug is enabled, Output file does nothing.]