http://imagej.273.s1.nabble.com/How-to-determine-the-current-macro-name-tp5015202p5015264.html
> On Dec 18, 2015, at 5:28 AM, Michael Entrup <
[hidden email]> wrote:
>
> Hi,
>
> this new function can be very useful for me. But the problem is, that I always get the same, wrong path.
>
> I'm using Fiji with IJ 1.50f24 on Windows 7. The minimal codes I run from the script editor is listed at the end of this mail. The result of both is:
>
> P:\PORTAB~1\Fiji.app\/macros/AutoRun/AutoRun_Scripts.ijm
>
> Looks like Fiji is disturbing the correct use of the new function.
You should report this bug using Fiji's Help>Report a Bug command so that it can be tracked and fixed.
> Macro ("C:\temp\New_.ijm"):
> requires("1.50f");
> var name = getInfo("macro.filepath");
> IJ.log(name);
>
>
> Jython ("C:\temp\New_.py"):
> from ij import IJ
> from ij.plugin import Macro_Runner
> name = Macro_Runner.getFilePath()
> IJ.log(name)
>
>
>
> Am 11.12.2015 um 13:31 schrieb Stein Rørvik:
>> Thanks, just what I needed.
>>
>> I tested this now on Windows:
>> It works for macros launched from the command line.
>> It works for macros installed under the plugins directory.
>> It works for macros launched by the runMacro() command.
>> It does not work however for macros installed "on-the-fly" by using menu Plugins - Macro - Install; it returns null.
>>
>> Stein
>>
>> -----Original Message-----
>> From: ImageJ Interest Group [mailto:
[hidden email]] On Behalf Of Rasband, Wayne (NIH/NIMH) [E]
>> Sent: 10. desember 2015 20:21
>> To:
[hidden email]
>> Subject: Re: How to determine the current macro name
>>
>>> On Dec 9, 2015, at 8:46 AM, Stein Rørvik <
[hidden email]> wrote:
>>>
>>> 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?
>>
>> Upgrade to the latest ImageJ daily build (1.50f19) and you can use getInfo("macro.filepath") to get file path and name of the currently loaded macro or script. In a plugin or script, use Macro_Runner.getFilePath().
>>
>> -wayne