In order to use plugins in scripts, it is important to separate more clearly ui from parameter settings :
initialize = plugin initialization (used only one time when loading the plugin)
execute = prompt the user with a dialog box. Parameters are set in plugin private fields
run = use private parameters to run the plugin. Don't prompt the user and don't use the dialog
parameters can be set with beanshell (set accessibility(true)) or with setters, or with a special run method taking parameters.
Michaël