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 |
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... 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 > > > |
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! |
Do anyone know how to do it in OSX, that is, what is the equivalent of the
Windows command: C:\Imagej\ImageJ.exe -macro "my macro" in OSX ? I tried java -jar -mx256m ij.jar -macro "my macro" but I don't think it goes into the right folder... nothing happens. Any ideas ? Christophe On Jan 20, 2008 1:30 PM, Ben Tupper <[hidden email]> wrote: > 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! > |
Hi,
On Mon, 21 Jan 2008, Christophe Leterrier wrote: > Do anyone know how to do it in OSX, that is, what is the equivalent of > the Windows command: > > C:\Imagej\ImageJ.exe -macro "my macro" > > in OSX ? I tried > > java -jar -mx256m ij.jar -macro "my macro" > > but I don't think it goes into the right folder... nothing happens. The easiest way to find out what is the correct command line is to look into Contents/Info.plist in the ImageJ.app/ folder (e.g. via Finder's context menu on the ImageJ icon; the action is called "Show Package Contents"). The key to look for is "CFBundleExecutable", and the command line is the corresponding string. Hth, Dscho |
On Jan 21, 2008 4:12 PM, Christophe Leterrier <
[hidden email]> wrote: > Great, finally it works ! > > Under OSX, to test a macro, I just have to use this as a command that I > can launch from my favorite OSX editor, Smultron (http://smultron.sourceforge.net/ > ): > > [PATH TO IMAGEJ]/ImageJ.app/Contents/MacOS/JavaApplicationStub -macro %%p > > Note that %%p is a Smultron-specific shortcut for the current open > document path > > The solution for XP using Notepad++ as an editor is in a previous mail of > this thread. > > I guess I could sum up everything about macro writing and put it on the > ImageJ wiki one of these days. > > Christophe Leterrier > > > > > > > > > On Jan 21, 2008 3:55 PM, Johannes Schindelin < [hidden email]> > wrote: > > > Hi, > > > > On Mon, 21 Jan 2008, Christophe Leterrier wrote: > > > > > Do anyone know how to do it in OSX, that is, what is the equivalent of > > > the Windows command: > > > > > > C:\Imagej\ImageJ.exe -macro "my macro" > > > > > > in OSX ? I tried > > > > > > java -jar -mx256m ij.jar -macro "my macro" > > > > > > but I don't think it goes into the right folder... nothing happens. > > > > The easiest way to find out what is the correct command line is to look > > into Contents/Info.plist in the ImageJ.app/ folder (e.g. via Finder's > > context menu on the ImageJ icon; the action is called "Show Package > > Contents"). > > > > The key to look for is "CFBundleExecutable", and the command line is the > > > > corresponding string. > > > > Hth, > > Dscho > > > > > |
In reply to this post by lechristophe
Hi,
I just tried it the following way on MacOS 10.4 (can't remember which cat that is). Since the ij.jar is buried inside the ImageJ.app (which is a directory really, try Ctrl-Click on the ImageJ.app icon and then select Show Package Contents from the context menu) you have to explicitly expand the path to it. [Sei:/Applications/ImageJ] Ben% java -jar -mx256m ImageJ.app/Contents/ Resources/Java/ij.jar -macro "Arrays.txt" If you do not have an instance of ImageJ running then it will close at the end of the macro's run. Otherwise, ImageJ will stay open. Hope that works for you, too. Cheers, Ben On Jan 21, 2008, at 9:32 AM, Christophe Leterrier wrote: > Do anyone know how to do it in OSX, that is, what is the equivalent > of the > Windows command: > > C:\Imagej\ImageJ.exe -macro "my macro" > > in OSX ? I tried > > java -jar -mx256m ij.jar -macro "my macro" > > but I don't think it goes into the right folder... nothing happens. > > Any ideas ? > > Christophe > > > > > On Jan 20, 2008 1:30 PM, Ben Tupper <[hidden email]> > wrote: > >> 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! >> 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! |
Thanks ! My previous commandline works also, thanks to Dscho, and it doesn't
open a second ImageJ or close it at the end (which is good). I just get this strange warnong from the command line log of my text editor : 2008-01-21 16:42:00.739 JavaApplicationStub[565] CFLog (0): CFMessagePort: bootstrap_register(): failed 1103 (0x44f), port = 0x10703, name = ' gov.nih.info.rsb.ImageJ.ServiceProvider' See /usr/include/servers/bootstrap_defs.h for the error codes. 2008-01-21 16:42:00.740 JavaApplicationStub[565] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port ( gov.nih.info.rsb.ImageJ.ServiceProvider) Any idea of what this means ? Christophe On Jan 21, 2008 4:35 PM, Ben Tupper <[hidden email]> wrote: > Hi, > > I just tried it the following way on MacOS 10.4 (can't remember which > cat that is). > > Since the ij.jar is buried inside the ImageJ.app (which is a > directory really, try Ctrl-Click on the ImageJ.app icon and then > select Show Package Contents from the context menu) you have to > explicitly expand the path to it. > > [Sei:/Applications/ImageJ] Ben% java -jar -mx256m ImageJ.app/Contents/ > Resources/Java/ij.jar -macro "Arrays.txt" > > If you do not have an instance of ImageJ running then it will close > at the end of the macro's run. Otherwise, ImageJ will stay open. > > Hope that works for you, too. > > Cheers, > Ben > > On Jan 21, 2008, at 9:32 AM, Christophe Leterrier wrote: > > > Do anyone know how to do it in OSX, that is, what is the equivalent > > of the > > Windows command: > > > > C:\Imagej\ImageJ.exe -macro "my macro" > > > > in OSX ? I tried > > > > java -jar -mx256m ij.jar -macro "my macro" > > > > but I don't think it goes into the right folder... nothing happens. > > > > Any ideas ? > > > > Christophe > > > > > > > > > > On Jan 20, 2008 1:30 PM, Ben Tupper <[hidden email]> > > wrote: > > > >> 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! > >> > > 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! > |
Free forum by Nabble | Edit this page |