How to kill two simultaneous macros

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

How to kill two simultaneous macros

vischer
As a demo, I put the macro below into a text window and ran it twice. So these two macros, identified by starting time, ran in parallel. While the text window was active, I chose menu Debug>Abort. But I only could abort the second macro.
This happens  often, when I debug something and forget to abort before installing the improved text.
Something even worse happened when a program bug entered an infinite loop without wait() statement. Running invisibly in the background, it drowned my battery in no time.

Wouldn't it be better if Debug>Abort aborts all running macros? It also would make sense that if you install macros from a text window, any previously macros (from the same window?) could be killed.



macro "A"{
startTime = getTime%1000;
for(jj = 0; jj < 1000; jj++){
        print("started: " + startTime + "   jj=" +  jj);
        wait(1000);
}


output:
=======
started: 196   jj=0
started: 196   jj=1
started: 196   jj=2
started: 196   jj=3
started: 196   jj=4
started: 196   jj=5
started: 821   jj=0
started: 196   jj=6
started: 821   jj=1
started: 196   jj=7

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

Re: How to kill two simultaneous macros

Rasband, Wayne (NIH/NIMH) [E]
> On Apr 7, 2015, at 7:07 PM, Norbert Vischer <[hidden email]> wrote:
>
> As a demo, I put the macro below into a text window and ran it twice. So these two macros, identified by starting time, ran in parallel. While the text window was active, I chose menu Debug>Abort. But I only could abort the second macro.

The macro editor in the latest ImageJ daily build (1.49r13) aborts any currently running macro before running or debugging another one.

-wayne

> This happens  often, when I debug something and forget to abort before installing the improved text.
> Something even worse happened when a program bug entered an infinite loop without wait() statement. Running invisibly in the background, it drowned my battery in no time.
>
> Wouldn't it be better if Debug>Abort aborts all running macros? It also would make sense that if you install macros from a text window, any previously macros (from the same window?) could be killed.
>
>
>
> macro "A"{
> startTime = getTime%1000;
> for(jj = 0; jj < 1000; jj++){
> print("started: " + startTime + "   jj=" +  jj);
> wait(1000);
> }
>
>
> output:
> =======
> started: 196   jj=0
> started: 196   jj=1
> started: 196   jj=2
> started: 196   jj=3
> started: 196   jj=4
> started: 196   jj=5
> started: 821   jj=0
> started: 196   jj=6
> started: 821   jj=1
> started: 196   jj=7
>
> Norbert Vischer
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html

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