beanshell and javascript interoperability

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

beanshell and javascript interoperability

Yoram Fisher
I enjoy writing scripts that do not require the full development IDE of developing JAVA.
I began with BeanShell, as that is very similar to Java, and much prefer the strongly typed nature compared to Javascript.

However, I ran into corner with BeanShell.
There is a method in Javascript to encapsulate namespaces inside functions, and it alloys for breaking up code into multiple file.
I refer to the load() command, described here: https://imagej.net/JavaScript_Scripting

I cannot find any equivalent in BeanShell. Is there a way to specify multiple .bsh files, similar to the load command?

On a related note, is there any way to call a .bsh script (or plugin) from javascript script?  I have tried using
IJ.run(), IJ.runPlugIn(), but those do not return the object, or at least I have not been able to get it to work.

I have attempted to re-write some of my BeanShell scripts into Javascript to overcome the lack of load() functionality, but this version of Javascript does not appear to support 'extends' or 'class' , so inheritance has become very messy if not impossible(?) to get working in Javascript.

Thanks,
  - Yoram -

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html