BeanShell Interpreter

History: 2012/11/08: First release
2013/03/03: Extends PlugInInterpreter
2013/03/20: Added getArgument() function
Requires: ImageJ 1.47m or later
Source: bsh.java
Installation: This plugin (BeanShell.jar), which includes the BeanShell interpreter, is automatically downloaded to Image/plugins/jars the first time you run a BeanShell (".bsh") script.
Description: This is the plugin and BeanShell interpreter that implement the macro editor's Macros>Evaluate BeanShell command. For more information about the BeanShell scripting language, go to www.beanshell.org.

These import statements, and a print() function, are automatically added to BeanShell scripts:

    importPackage(Packages.ij)
    importPackage(Packages.ij.gui)
    importPackage(Packages.ij.process)
    importPackage(Packages.ij.measure)
    importPackage(Packages.ij.util)
    importPackage(Packages.ij.plugin)
    importPackage(Packages.ij.io)
    importPackage(Packages.ij.plugin.filter)
    importPackage(Packages.ij.plugin.frame)
    importPackage(java.lang)
    importPackage(java.awt)
    importPackage(java.awt.image)
    importPackage(java.awt.geom)
    importPackage(java.util)
    importPackage(java.io)
    function print(s) {IJ.log(s)}

See Also: Example BeanShell Scripts
Beanshell Scripting - Fiji
eval("bsh",script) macro function
Macro_Runner.runBeanShell(script,arg) method
Macro_Runner.runMacroFile(name,arg) method