Login  Register

Re: How to determine the current macro name

Posted by Stein Rørvik on Dec 10, 2015; 2:10pm
URL: http://imagej.273.s1.nabble.com/How-to-determine-the-current-macro-name-tp5015202p5015204.html

I need this because I maintain one macro that I put in different directories,
and the macro should behave differently depending on where its current location is.

I launch the macro from the command line on Windows.

I tried to read File.directory and File.name but they are both blank.

getList("window.titles") also does not work because there is no open macro window.

Is there some java property that I can read somewhere to determine the location and name of the macro that was launched from the command line?

Stein

-----Original Message-----
From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of Volker Baecker
Sent: 10. desember 2015 13:44
To: [hidden email]
Subject: Re: How to determine the current macro name

I don't think there is a simple way to do this.

File.directory
File.name

work for macro files as for other files, however you have to run the command after opening the macro and before opening any other file.

getList("window.titles");

gives a list of all none image window titles including macros.

Maybe we can help more if you tell us why you need this.

Best regards,
Volker Baecker

Stein Rørvik:

> Simple question:
>
> Is there any way an ImageJ macro can determine its own filename?
> That is, any way to read the name and file path of the currently
> loaded macro file?
>
> Stein
>
> -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

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