Function to abort macro

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

Function to abort macro

PEARSON Matthew
Hi all,

Is there a function in the macro language that will just abort a macro, equivalent to pressing escape key.  I have a radio button dialog and there a few options for the user to choose from and i wanted one of those to be an option to exit the macro.  I see there is a run("Quit") command but that quit's imagej and is a little extreme.  Something like run("Abort") would be nice but alas obviously doesn't exist.  Alternatively some way to make the macro jump over my remaining code blocks if this "Exit" radio button is selected then it will end on its own.  I've roughly copied the structure below to demonstrate what i'm trying to do.

Thanks for the help!

Matt

Radio button dialog options:
-Append results and next image
-Skip image
-Exit

if "append" {
statements
}

else if "skip" {
statements
}

else {
Exit macro somehow
}

Further code blocks associated with a loop outwith the above code




--
Matt Pearson
Microscopy Facility
MRC Human Genetics Unit
Institute of Genetics and Molecular Medicine (IGMM)
University of Edinburgh
Crewe Road
EH4 2XU





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

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

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

Re: Function to abort macro

Herbie
Matt,

why not use exit() ?


"exit() or exit("error message")
Terminates execution of the macro and, optionally, displays an error
message."

Best

Herbie

::::::::::::::::::::::::::::::::::::::::::::
Am 25.10.16 um 17:42 schrieb PEARSON Matthew:

> Hi all,
>
> Is there a function in the macro language that will just abort a macro, equivalent to pressing escape key.  I have a radio button dialog and there a few options for the user to choose from and i wanted one of those to be an option to exit the macro.  I see there is a run("Quit") command but that quit's imagej and is a little extreme.  Something like run("Abort") would be nice but alas obviously doesn't exist.  Alternatively some way to make the macro jump over my remaining code blocks if this "Exit" radio button is selected then it will end on its own.  I've roughly copied the structure below to demonstrate what i'm trying to do.
>
> Thanks for the help!
>
> Matt
>
> Radio button dialog options:
> -Append results and next image
> -Skip image
> -Exit
>
> if "append" {
> statements
> }
>
> else if "skip" {
> statements
> }
>
> else {
> Exit macro somehow
> }
>
> Further code blocks associated with a loop outwith the above code
>
>
>
>
> --
> Matt Pearson
> Microscopy Facility
> MRC Human Genetics Unit
> Institute of Genetics and Molecular Medicine (IGMM)
> University of Edinburgh
> Crewe Road
> EH4 2XU
>
>
>
>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
>
>
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
> --
> 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: Function to abort macro

PEARSON Matthew
In reply to this post by PEARSON Matthew
Ah thanks Herbie i was using find to search the functions page and tried abort, quit, everything except "exit"!  Exactly what i'm after.

cheers,

Matt


--
Matt Pearson
Microscopy Facility
MRC Human Genetics Unit
Institute of Genetics and Molecular Medicine (IGMM)
University of Edinburgh
Crewe Road
EH4 2XU




On 25 Oct 2016, at 16:42, PEARSON Matthew <[hidden email]<mailto:[hidden email]>>
 wrote:

Hi all,

Is there a function in the macro language that will just abort a macro, equivalent to pressing escape key.  I have a radio button dialog and there a few options for the user to choose from and i wanted one of those to be an option to exit the macro.  I see there is a run("Quit") command but that quit's imagej and is a little extreme.  Something like run("Abort") would be nice but alas obviously doesn't exist.  Alternatively some way to make the macro jump over my remaining code blocks if this "Exit" radio button is selected then it will end on its own.  I've roughly copied the structure below to demonstrate what i'm trying to do.

Thanks for the help!

Matt

Radio button dialog options:
-Append results and next image
-Skip image
-Exit

if "append" {
statements
}

else if "skip" {
statements
}

else {
Exit macro somehow
}

Further code blocks associated with a loop outwith the above code




--
Matt Pearson
Microscopy Facility
MRC Human Genetics Unit
Institute of Genetics and Molecular Medicine (IGMM)
University of Edinburgh
Crewe Road
EH4 2XU





--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

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


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

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

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