Closed Michael-Gaehwiler closed 5 years ago
You can achieve this using the --force-single-instance
flag.
Launch one instance using an invocation like:
DEBUG=1 /Applications/Fiji.app/Contents/MacOS/ImageJ-macosx -- --force-single-instance -eval 'print("Hello 1")'
And then launch another one, which will hand off its arguments to the first:
DEBUG=1 /Applications/Fiji.app/Contents/MacOS/ImageJ-macosx -- --force-single-instance -eval 'print("Hello 2")'
The DEBUG=1
is not necessary, but maybe useful to see what's going on with the single instance logic, justt in case there are problems.
=> first time fiji opens and the marco is run. the second time it only shows the already open Fiji instance (good) but does not run the macro (bad)
If I run /Applications/Fiji.app/Contents/MacOS/ImageJ-macosx -macro "some_macro_file.txt" ApplicationID0-, a new instance of Fiji is opened (bad) and the macro is run (good).
What we like to have is, to run macros via terminal but only having one instance of Fiji