How to open a file in the Fiji script editor from a macro?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to open a file in the Fiji script editor from a macro?

Jürgen Gluch
Hello,

how can I open a file in the Fiji script editor from a macro? I tried

  run("Script", "open=test.txt");
  run("Script", "test.txt");

This opens the script editor and sets the file name, but does not open
the existing file. Unfortunately I was not able to find documentation
about macro options of the script editor online.

Jürgen

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to open a file in the Fiji script editor from a macro?

dscho
Hi Juergen,

On Fri, 7 Mar 2014, Jürgen Gluch wrote:

> how can I open a file in the Fiji script editor from a macro? I tried
>
>   run("Script", "open=test.txt");
>   run("Script", "test.txt");

Please note that ".txt" is a very good file extension for text files; for
macro files, ".ijm" is a good file extension.

With that in mind,

        open("/path/to/my-macro.ijm");

does exactly what you want here.

Ciao,
Johannes

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to open a file in the Fiji script editor from a macro?

Jan Eglinger
In reply to this post by Jürgen Gluch
Hi Jürgen,

On 07.03.2014, 11:05 AM, Jürgen Gluch wrote:
> how can I open a file in the Fiji script editor from a macro? I tried
>
>    run("Script", "open=test.txt");
>    run("Script", "test.txt");
>
> This opens the script editor and sets the file name, but does not open
> the existing file. Unfortunately I was not able to find documentation
> about macro options of the script editor online.
>

Try

open("/path/to/your/macro.txt");

or

open("/path/to/your/macro.ijm");

When opening a .txt file, you still have to select the language manually
using 'Language > ImageJ Macro' in the script editor's menu.

I've noticed that the macro recorder does not record this command when
using drag and drop to open the file. Opening via 'File > Open...'
records the correct command, however.

Jan

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: How to open a file in the Fiji script editor from a macro?

Jürgen Gluch
In reply to this post by dscho
Hi,

Thank you, works perfect.

Jürgen

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