macros/AutoRun/*.ijm

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

macros/AutoRun/*.ijm

dscho
Dear Fiji users,

Fiji learnt a new trick today: it will run the macros stored in the
macros/AutoRun/ directory as .ijm files (if any) when starting, unless you
have a locally-modified StartupMacros.fiji.ijm.

This is in particular useful if you want to serve macros via an update
site that need to be installed (e.g. to be available as keyboard
shortcuts).

Ciao,
Johannes

P.S.: If you are interested in the details, or want to make the same
available in "vanilla ImageJ":
https://github.com/fiji/fiji/commit/371d3786ffcacb2c5f2ebbfb31de7526180e6338

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

Re: macros/AutoRun/*.ijm

Rainer M. Engel
Hey Johannes,

that is a nice thought to make things more elegant here.

I'll probably use that some time soon..

Regards,
Rainer



Am 15.03.2013 22:43, schrieb Johannes Schindelin:

> Dear Fiji users,
>
> Fiji learnt a new trick today: it will run the macros stored in the
> macros/AutoRun/ directory as .ijm files (if any) when starting, unless you
> have a locally-modified StartupMacros.fiji.ijm.
>
> This is in particular useful if you want to serve macros via an update
> site that need to be installed (e.g. to be available as keyboard
> shortcuts).
>
> Ciao,
> Johannes
>
> P.S.: If you are interested in the details, or want to make the same
> available in "vanilla ImageJ":
> https://github.com/fiji/fiji/commit/371d3786ffcacb2c5f2ebbfb31de7526180e6338
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Re: macros/AutoRun/*.ijm

Niko Ehrenfeuchter
Dear Johannes,

On 18.03.2013 17:13, Rainer M. Engel wrote:
> Hey Johannes,
>
> that is a nice thought to make things more elegant here.

I absolutely agree with Rainer, this is a very nice feature!

Did I get this right, as soon as you're having a modified
"StartupMacros.fiji.ijm" the contents of the AutoRun directory will be
ignored?

Cheers
Niko


--
Niko Ehrenfeuchter
Imaging Core Facility
Kragenbau, Room G1055
Biozentrum, University of Basel
Klingelbergstrasse 50/70
CH-4056 Basel (Switzerland)

Office:  +41 (61) 26 72673
Email:   [hidden email]

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

Re: macros/AutoRun/*.ijm

dscho
Hi Niko,

On Mon, 18 Mar 2013, Niko Ehrenfeuchter wrote:

> On 18.03.2013 17:13, Rainer M. Engel wrote:
>
> > that is a nice thought to make things more elegant here.
>
> I absolutely agree with Rainer, this is a very nice feature!
>
> Did I get this right, as soon as you're having a modified
> "StartupMacros.fiji.ijm" the contents of the AutoRun directory will be
> ignored?

What I meant is: if you modified StartupMacros.fiji.ijm, the updater will
not mark this file for update and therefore you will not get the new
version that looks at macros/AutoRun/.

Of course, in such a case you could still copy the relevant part from

        https://github.com/fiji/fiji/blob/master/macros/StartupMacros.fiji.ijm#L48

and paste it into your locally-modified StartupMacros.fiji.ijm.

And I completely forgot that StartupMacros.fiji.ijm would not be executed
if there is a StartupMacros.ijm in macros/, either...

Ciao,
Johannes

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

Re: macros/AutoRun/*.ijm

ctrueden
Hi everyone,

> Of course, in such a case you could still copy the relevant part from
>
>
https://github.com/fiji/fiji/blob/master/macros/StartupMacros.fiji.ijm#L48
>
> and paste it into your locally-modified StartupMacros.fiji.ijm.

Or, you could take your local modifications and "externalize" them by
moving them into the macros/AutoRun/ folder, so that your
StartupMacros.fiji.ijm is no longer considered locally modified. You still
receive the benefit of your customizations, and Fiji can still keep itself
fully up to date in the future too!

Regards,
Curtis

On Mon, Mar 18, 2013 at 11:41 AM, Johannes Schindelin
<[hidden email]> wrote:

> Hi Niko,
>
> On Mon, 18 Mar 2013, Niko Ehrenfeuchter wrote:
>
>> On 18.03.2013 17:13, Rainer M. Engel wrote:
>>
>> > that is a nice thought to make things more elegant here.
>>
>> I absolutely agree with Rainer, this is a very nice feature!
>>
>> Did I get this right, as soon as you're having a modified
>> "StartupMacros.fiji.ijm" the contents of the AutoRun directory will be
>> ignored?
>
> What I meant is: if you modified StartupMacros.fiji.ijm, the updater will
> not mark this file for update and therefore you will not get the new
> version that looks at macros/AutoRun/.
>
> Of course, in such a case you could still copy the relevant part from
>
>
https://github.com/fiji/fiji/blob/master/macros/StartupMacros.fiji.ijm#L48

>
> and paste it into your locally-modified StartupMacros.fiji.ijm.
>
> And I completely forgot that StartupMacros.fiji.ijm would not be executed
> if there is a StartupMacros.ijm in macros/, either...
>
> Ciao,
> Johannes
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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

Re: macros/AutoRun/*.ijm

Niko Ehrenfeuchter
Dear Curtis,

On 18.03.2013 17:49, Curtis Rueden wrote:

> Hi everyone,
>
>> Of course, in such a case you could still copy the relevant part from
>>
>>
> https://github.com/fiji/fiji/blob/master/macros/StartupMacros.fiji.ijm#L48
>>
>> and paste it into your locally-modified StartupMacros.fiji.ijm.
>
> Or, you could take your local modifications and "externalize" them by
> moving them into the macros/AutoRun/ folder, so that your
> StartupMacros.fiji.ijm is no longer considered locally modified. You still
> receive the benefit of your customizations, and Fiji can still keep itself
> fully up to date in the future too!

that's exactly why I like the approach of the separate directory so
much. I just have to tell my users here how to reach this state with
their possibly modified FiJi installations :)

Thanks for sharing,
Niko

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

Re: macros/AutoRun/*.ijm

Rainer M. Engel
In reply to this post by dscho
Am 18.03.2013 17:41, schrieb Johannes Schindelin:

> Hi Niko,
>
> On Mon, 18 Mar 2013, Niko Ehrenfeuchter wrote:
>
>> On 18.03.2013 17:13, Rainer M. Engel wrote:
>>
>>> that is a nice thought to make things more elegant here.
>>
>> I absolutely agree with Rainer, this is a very nice feature!
>>
>> Did I get this right, as soon as you're having a modified
>> "StartupMacros.fiji.ijm" the contents of the AutoRun directory will be
>> ignored?
>
> What I meant is: if you modified StartupMacros.fiji.ijm, the updater will
> not mark this file for update and therefore you will not get the new
> version that looks at macros/AutoRun/.
>
> Of course, in such a case you could still copy the relevant part from
>
> https://github.com/fiji/fiji/blob/master/macros/StartupMacros.fiji.ijm#L48
>
> and paste it into your locally-modified StartupMacros.fiji.ijm.
>
> And I completely forgot that StartupMacros.fiji.ijm would not be executed
> if there is a StartupMacros.ijm in macros/, either...


My StartupMacros doesn't do what it should, I guess. I've downloaded a
fresh Fiji for Windows and updated it. I installed "ActionBar" and
created an "AutoRun" folder as sub-directory for "macros", but my
ActionBar isn't started, although the macro command for itself works..

I saved a short "Hello world"-macro there (to AutoRun) either, which
isn't executed too.

If an unaltered "StartupMacros.fiji.ijm" executes all scripts from
"AutoRun", I would like to have this folder directly from the
installation with maybe a short help-file, explaining what this folder
is meant for.


Best regards,
Rainer


--
Rainer M. Engel, Dipl. Digital Artist
scientific|Media GbR
Pichelsdorfer Str. 143
13595 Berlin

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

Re: macros/AutoRun/*.ijm

dscho
Hi Rainer,

On Tue, 30 Jul 2013, Rainer M. Engel wrote:

> Am 18.03.2013 17:41, schrieb Johannes Schindelin:
> >
> > On Mon, 18 Mar 2013, Niko Ehrenfeuchter wrote:
> >
> >> On 18.03.2013 17:13, Rainer M. Engel wrote:
> >>
> >>> that is a nice thought to make things more elegant here.
> >>
> >> I absolutely agree with Rainer, this is a very nice feature!
> >>
> >> Did I get this right, as soon as you're having a modified
> >> "StartupMacros.fiji.ijm" the contents of the AutoRun directory will be
> >> ignored?
> >
> > What I meant is: if you modified StartupMacros.fiji.ijm, the updater will
> > not mark this file for update and therefore you will not get the new
> > version that looks at macros/AutoRun/.
> >
> > Of course, in such a case you could still copy the relevant part from
> >
> > https://github.com/fiji/fiji/blob/master/macros/StartupMacros.fiji.ijm#L48
> >
> > and paste it into your locally-modified StartupMacros.fiji.ijm.
> >
> > And I completely forgot that StartupMacros.fiji.ijm would not be executed
> > if there is a StartupMacros.ijm in macros/, either...
>
>
> My StartupMacros doesn't do what it should, I guess. I've downloaded a
> fresh Fiji for Windows and updated it. I installed "ActionBar" and
> created an "AutoRun" folder as sub-directory for "macros", but my
> ActionBar isn't started, although the macro command for itself works..

Niko actually reported this project, although he did so in the #fiji-devel
chat (which is not quite as visible as the ImageJ mailing list).

I'll try very hard to find the time to fix this problem as soon as
possible!

Ciao,
Johannes

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

Re: macros/AutoRun/*.ijm

dscho
Hi Rainer,

On Tue, 30 Jul 2013, Johannes Schindelin wrote:

> On Tue, 30 Jul 2013, Rainer M. Engel wrote:
>
> > Am 18.03.2013 17:41, schrieb Johannes Schindelin:
> > >
> > > On Mon, 18 Mar 2013, Niko Ehrenfeuchter wrote:
> > >
> > >> On 18.03.2013 17:13, Rainer M. Engel wrote:
> > >>
> > >>> that is a nice thought to make things more elegant here.
> > >>
> > >> I absolutely agree with Rainer, this is a very nice feature!
> > >>
> > >> Did I get this right, as soon as you're having a modified
> > >> "StartupMacros.fiji.ijm" the contents of the AutoRun directory will
> > >> be ignored?
> > >
> > > What I meant is: if you modified StartupMacros.fiji.ijm, the updater
> > > will not mark this file for update and therefore you will not get
> > > the new version that looks at macros/AutoRun/.
> > >
> > > Of course, in such a case you could still copy the relevant part
> > > from
> > >
> > > https://github.com/fiji/fiji/blob/master/macros/StartupMacros.fiji.ijm#L48
> > >
> > > and paste it into your locally-modified StartupMacros.fiji.ijm.
> > >
> > > And I completely forgot that StartupMacros.fiji.ijm would not be
> > > executed if there is a StartupMacros.ijm in macros/, either...
> >
> >
> > My StartupMacros doesn't do what it should, I guess. I've downloaded a
> > fresh Fiji for Windows and updated it. I installed "ActionBar" and
> > created an "AutoRun" folder as sub-directory for "macros", but my
> > ActionBar isn't started, although the macro command for itself works..
>
> Niko actually reported this project, although he did so in the
> #fiji-devel chat (which is not quite as visible as the ImageJ mailing
> list).
>
> I'll try very hard to find the time to fix this problem as soon as
> possible!

It turns out that I misread a patch in ImageJ 1.x to be nicer to Fiji than
it actually is: we still have to patch the code to make sure that
StartupMacros.fiji.ijm is run if it exists.

This has been fixed now, along with a couple of other issues, and uploaded
to the update site.

Ciao,
Johannes

P.S.: You may have noticed that Fiji tries to leave 24 hours between
bugging you about updates? So you might have to start it manually by
clicking on Help>Update Fiji.

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

Re: macros/AutoRun/*.ijm

Martin Höhne
Dear list,

I had some modifications in the StartupMacros.txt which I moved to the macros/AutoRun

The difference is that while being part of the StartupMacros.txt, the macro was only installed so that it could be called by the F9 key, but the macro was not executed when starting Fiji.

After moving the macro to macros/AutoRun, the macro is not only installed but also executed upon starting Fiji


// macro to add the marker lane to fusion western blot images  
macro "Western marker[f9]" {
        /*
         * Macro for adding the marker lane to the blot image
         * with the files from the fusion machine
         *
.........
}

Is there a way of installing without execution upon startup?


Thanks,
Martin


Reply | Threaded
Open this post in threaded view
|

Re: macros/AutoRun/*.ijm

dscho
Hi Martin,

On Thu, 1 Aug 2013, Martin Höhne wrote:

> I had some modifications in the StartupMacros.txt which I moved to the
> macros/AutoRun
>
> The difference is that while being part of the StartupMacros.txt, the
> macro was only installed so that it could be called by the F9 key, but
> the macro was not executed when starting Fiji.

Right, the intention of AutoRun/*.ijm was to run at start up, not
necessarily to install shortcuts.

> After moving the macro to macros/AutoRun, the macro is not only
> installed but also executed upon starting Fiji
>
>
> // macro to add the marker lane to fusion western blot images  
> macro "Western marker[f9]" {
> /*
> * Macro for adding the marker lane to the blot image
> * with the files from the fusion machine
> *
> .........
> }
>
> Is there a way of installing without execution upon startup?
It gets worse. Every macro that is installed in StartupMacros.fiji.ijm is
forgotten. The reason is that ImageJ 1.x's concept of "installing macros"
is quite limited: if you execute Plugins>Macros>Install... and select a
file, that file's macros get installed, but not only that: previously
installed macros simply are uninstalled. Completely.

Just try it: write, say, macro1.ijm with the contents

        macro "Blub [f7]" { showStatus("f7"); }

and, say, macro2.ijm which does the same for f6. Then install macro1.ijm
with Plugins>Macros>Install..., verify that f7 triggers "f7" in the status
bar, then install macro2.ijm, and f7 will no longer work!

I was so close (imagine me holding my fingers about one micro-meter apart,
very close to your face) trying to address that in Fiji, but I have a
hunch that Wayne will fix this (and the way these fixes work, they always
break the work-arounds in Fiji, and I always find out about that the hard
and painful way).

So in the meantime I suggest that you put your macros defining shortcuts
into a single file, say, Fiji.app/macros/my-shortcuts.ijm, and then add a
file install-shortcuts.ijm into your Fiji.app/macros/AutoRun containing
just these two lines:

        run("Install...", "install=[" + getDirectory("imagej")
                + "/macros/my-shortcuts.ijm]");

Sorry, this is the best I can do for the moment...
Johannes

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

Re: macros/AutoRun/*.ijm

Martin Höhne
Hi Johannes,
...
So in the meantime I suggest that you put your macros defining shortcuts
into a single file, say, Fiji.app/macros/my-shortcuts.ijm, and then add a
file install-shortcuts.ijm into your Fiji.app/macros/AutoRun containing
just these two lines:

        run("Install...", "install=[" + getDirectory("imagej")
                + "/macros/my-shortcuts.ijm]");
That works perfectly fine!

Sorry, this is the best I can do for the moment...
No need to apologize for all the great work you´re doing!

Martin
Reply | Threaded
Open this post in threaded view
|

Re: macros/AutoRun/*.ijm

thenork
...
So in the meantime I suggest that you put your macros defining shortcuts
into a single file, say, Fiji.app/macros/my-shortcuts.ijm, and then add a
file install-shortcuts.ijm into your Fiji.app/macros/AutoRun containing
just these two lines:

        run("Install...", "install=[" + getDirectory("imagej")
                + "/macros/my-shortcuts.ijm]");

There's also another thing.  I have written some startupmacros which have their own AutoRun code that it runs at startup.  Macro that are installed via this method don't run that code, so this unfortunately does not work for me.  

What I used to do is just have a file called "StartupMacros.ijm" in the macros folder.  This was ideal because it did not interfere with "StartupMacros.fiji.ijm" updating.  It overrides it, like I want it to.  And when I went to the menu item "StarupMacros" it opened in the Script editor.  

So my suggestion is that the AutoRun stuff is great for those who need it, but can't we keep the StartupMacros.ijm override for people who want it?
Thanks!

-Aaron