JEB clients can execute Python scripts.

- Scripts should perform relatively small, light-weight actions 
- They are written using the Python 2.7 syntax and features, and are executed by a [Jython VM](https://www.jython.org)
- An interactive console is also provided within the GUI client (see the Terminal fragment)

[![](img/7ea2f3e7-small.png)](img/7ea2f3e7.png)

# Features

Scripts can:

- Use the standard [JEB API](https://www.pnfsoftware.com/jeb/apidoc)
- Use the [Client API package](https://www.pnfsoftware.com/jeb/apidoc/com/pnfsoftware/jeb/client/api/package-summary.html)
- Use the [UI-API](https://www.pnfsoftware.com/jeb/apidoc/com/pnfsoftware/jeb/client/api/IGraphicalClientContext.html) if run within the GUI client

A client script implements the `IScript` interface. Upon execution, the script's `run()` entry-point method is provided an `IClientContext` or derived object, such as an `IGraphicalClientContext` for GUI clients, such as the official GUI client.

# A Simple Script

Here is the simplest of all scripts:

File: JEBSampleScript.py
```python
from com.pnfsoftware.jeb.client.api import IScript

class JEBSampleScript(IScript):
  def run(self, ctx):
    print('Hello, JEB version %s' % ctx.getSoftwareVersion())
    print('- Arguments: %s' % ctx.getArguments())
    print('- Base directory: %s' % ctx.getBaseDirectory())
```

Inside the GUI client, scripts can be executed via the *File, Scripts* menu (F2).

# More scripts

Check out our GitHub repository for [more sample scripts](https://github.com/pnfsoftware/jeb-samplecode/tree/master/scripts). Most sample scripts are also bundled with your JEB distribution, under the `scripts/samples/` directory.
