Skip to content

Writing Client Scripts

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
  • An interactive console is also provided within the GUI client (see the Terminal fragment)

Features#

Scripts can:

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

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. Most sample scripts are also bundled with your JEB distribution, under the scripts/samples/ directory.