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

Features#

Scripts can:

A client script implements the IScript interface. Upon execution, the script run() entry-point method is provided an IClientContext or derived object, such as an IGraphicalClientContext for UI clients, such as the official UI desktop client.

A Simple Script#

Here is the simplest of all scripts:

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 UI client, scripts can be executed via the File, Scripts menu (F2).

More scripts#

Check out our GitHub repository for many more sample scripts.