Macro Example
General
Macros written in jython/python can be run into jEdit quite easily in two
ways
- By calling them into the interpreter by the funciton
_execMacro("name.py"). The name has to correspond to a file stored either in
- [jEdit user's home dir]\jython, or
- [jEdit home dir]\jython
- By calling them from the BeanShell creating a macro which calls
jython.JythonExecutor.execMacro("name.py") that behaves exactly as the
former
Example
This example loads a web page via the Internet and puts its source on a jEdit
buffer. It pops-up a dialog requiesting the address, it parses it and loads it on
to a new buffer. It requires the standard libraries for jython.
Files:
- BeanShell macro:
copy it to your preferred macro directory. It is a stanard macro which executes
jython.JythonExecutor.execFile("load_web_page.py");
- Python macro: copy it to the jython\macro
directory. It does the actual work