imagej / imagej-launcher

The ImageJ native launcher
https://imagej.net/learn/launcher
BSD 2-Clause "Simplified" License
21 stars 23 forks source link

Support SciJava scripting framework better #15

Open dscho opened 10 years ago

dscho commented 10 years ago

@PaulVanSchayck pointed out that the Javascript support only works in Fiji.app/, not in ImageJ.app/. The best fix is to let the scripting framework handle things.

So if we detect that the first argument is a path to an existing file with a non-empty file extension, we should spin up a Context and ask the ScriptService whether it knows about the file extension, and let it handle the execution if it does.

This does not fix ImageJ-<platform> --js -- which is supposed to open an interactive console -- of course, but that is something we might have to address in the ScriptService instead (or in a to-be-introduced ScriptInterpreterService).

PaulVanSchayck commented 10 years ago

Would this bug also explain why the load('otherfile.js') function cannot be used when calling a script from Plugins -> Macros -> Run or when calling the script using ImageJ-linux64 -macro script.js. When using the new ScriptEditor and pressing ctrl+r it does work.

The error in the cases load() is not working is:

   ReferenceError: "load" is not defined. (<Unknown source>#43) in <Unknown source> at line number 43

This only happens in Linux by the way, in Windows I can use Plugins -> Macros -> Run. This is all IJ2-rc13.