Writing Client Scripts

All JEB builds permit running scripts:

Prerequisite

A Jython stand-alone package is required to run scripts. Jython ships by default with JEB 3.1 builds.

Legacy: If you are using JEB2, download either Jython 2.7 (newer, slower to load) or Jython 2.5 (older and slimmer, faster to load) and drop it in your JEB scripts/ sub-directory.

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())

Within the official desktop client, scripts can be executed via the File, Scripts menu item.

Remember that heavy-lifting operations (such as parsing or background event-driven tasks) should be implemented by back-end plugins in Java.

More scripts

Check out our GitHub repository for more sample scripts.