Writing Client Scripts - JEB Decompiler
Author: PNF Software

# Writing Client Scripts

All JEB builds permit running scripts:

- Scripts are meant to execute small, light-weight actions
- They can be written using the Python 2.5 or 2.7 syntax and features, and are executed by a Jython VM

## 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:

- use the standard JEB API
- use the Client API package
- if run within a client that implements the UI-API, use the JEB UI Client API

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.

#### Search

From here you can search these documents. Enter your search terms below.

#### Keyboard Shortcuts

Keys | Action
--- | ---
`?` | Open this help
`n` | Next page
`p` | Previous page
`s` | Search