This question is related to those previous posts:
I am also trying to call a script (subScript) from another script (mainScript).
subScript would be a local file written in any of the scripting language, and the input arguments for subScript would be passed as a string from mainScript similar to the macro recorder execution.
So basically the GUI for mainScript would look like that (in reality I will have other fields in the future for the main script)
FolIowing the previous post, I managed to use
ScriptService.run(PathToSubScript..) using script parameters for the input of SubScript.
The problem is that this command expects the parameters to be formatted into a list style like
[param1,value1,param2,val2] (in Jython at least). Which is not very user-friendly nor straightforward by programing.
It also does not work if subScript is using the GenericDialog class for the input.
I also tried to use
which would be convenient as the
Args string can be copy/past from the macro recorder.
However I found out that the subScript must call
IJ.getArgs to get the string of arguments, which means “manually” parsing the string. Not very convenient and not what most plugins do.
This solution is also very much ImageJ1 so it does not work to call some services in subScript.
Here some example with Jython scripts
#@ ScriptService scriptService #@ String any #@ File subScript from ij import IJ # Option 1: runMacroFile IJ.runMacroFile(subScript.getAbsolutePath(), "some_string=esfhseh") # With Generic dialog ->opens the GUI, with script_parameters does not get the variable # Option 2: ScriptService params = ["some_string", "Bla" ] # to be passed to subScript scriptService.run(subScript, True, params) # works with script parameters only not GenericDialog
#@ String some_string from ij import IJ IJ.log(some_string)
So I am looking for a more straightforward way to call an external script with a string of arguments as returned by the macro recorder.