Login  Register

Re: Launch a macro from a command line

Posted by Ben Tupper on Jan 20, 2008; 12:30pm
URL: http://imagej.273.s1.nabble.com/Launch-a-macro-from-a-command-line-tp3697493p3697495.html

On Jan 20, 2008, at 6:58 AM, Christophe Leterrier wrote:

> After looking for a solution, I found this:
>
> You can use Notepad++ (http://notepad-plus.sourceforge.net/uk/ 
> site.htm) and
> configure the "Execute" menu to run the following command (assuming  
> the path
> to ImageJ.exe is modified for your specific installation) :
>
> C:\Imagej\ImageJ.exe -macro "$(FULL_CURRENT_PATH)"
>
> as explained here : http://notepad-plus.sourceforge.net/uk/site.htm
>
> and it will launch your current macro. The only small problem is  
> that if
> your macro starts by asking to choose a file (and you're using a  
> test file
> to program your macro), the default folder proposed in the open  
> dialog will
> be the ImageJ.exe folder, i.e. it won't remember the specific path  
> to your
> test file so you will have to have it not to far away from the  
> ImageJ.exe...
>

Hi,

The ImageJ API documentation states that the "-macro" command line  
arguments may include an argument.

See http://rsb.info.nih.gov/ij/developer/api/index.html > ij > ImageJ  
API documentation...

> The following command line options are recognized by ImageJ:
<snip>
>   -macro path [arg]
>      Runs a macro, passing it an optional argument
>      Example 1: -macro analyze.ijm
>      Example 2: -macro analyze /Users/wayne/images/stack1



Perhaps that would do it for you?

Cheers,
Ben


> Christophe
>
> PS/ I also managed to get ImageJ installed on an external hard  
> drive, by
> installing the MBF_ImageJ package and then adding the ImageJ.app  
> from the
> regular OSX install into the ImageJ folder. Let alone the IJ_Prefs.txt
> glitch (those using MBF_ImageJ under OSX will know what I'm talking  
> about),
> what you get is a portable, multi-platform ImageJ install (as long  
> as the
> machine you run it on have a proper Java installed for OSX, for  
> Windows I
> think it uses the bundled java jre). So no more sync problem  
> between plugins
> and macro between home and work computers, which was a real pain.
>
>
>
> On Jan 20, 2008 12:24 PM, Christophe Leterrier <
> [hidden email]> wrote:
>
>> Dear all,
>>
>> I'm using an external notepad to edit ImageJ macros under Windows XP
>> (namely, Notepad2 from http://www.flos-freeware.ch/notepad2.html),  
>> for
>> syntax coloring, lines number display, easy indentation, etc...but  
>> I would
>> like to have a simple way to run the macro directly from the  
>> notepad in an
>> already open ImageJ, without having to go into ImageJ, dive into
>> Plugins/Macros/Run to run it. Is there a simple command line/
>> script that
>> would allow me to do that ?
>>
>> On a related note, on OSX it is really easy because you can drag  
>> and drop
>> the icon from the title bar of the notepad window (whatever editor  
>> you're
>> using) into ImageJ and ImageJ will open the macro, so just drag  
>> and drop +
>> command-R and you're good to go !
>>
>> Thank you,
>>
>> Christophe Leterrier
>>
>> Postdoc
>> INSERM UMR641 Neurobiology of ionic channels
>> IFR Jean Roche - Mediterranee University
>> Marseille, France
>>
>>
>>

Ben Tupper
[hidden email]

I GoodSearch for Ashwood Waldorf School.

Raise money for your favorite charity or school just by searching the  
Internet with GoodSearch - www.goodsearch.com - powered by Yahoo!