Writing Client Scripts

JEB Standard and JEB Business builds permit running scripts:

Prerequisite

A Jython stand-alone package is required to run scripts.

Download either Jython 2.7 Standalone (newer, slower to load) or Jython 2.5 Standalone (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 RCP desktop client.

A Simple Script

Here is the simplest of all scripts:

from com.pnfsoftware.jeb.client.api import IScript

class JEB2SampleScript(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.