Posted by
William Joseph Ashby on
Oct 08, 2009; 2:54pm
URL: http://imagej.273.s1.nabble.com/I-can-t-run-a-macro-tp3690875p3690878.html
If you used the macro recorder, then you're macro should have a line similar
to this.
open("/Users/willashby/Desktop/MyFolder/MyImage.JPG");
If it doesn't make sure you use the open command to open your images rather
than dragging and dropping them onto ImageJ which results in this.
selectWindow("MyImage-1.JPG");
This command won't open images when you run a macro.
When I started doing macros in ImageJ, I would record what I needed done
using the recorder, create a macro from that, save it, and then open it in a
texteditor. Using the texteditor, I would copy the macro as many times as I
needed then use the find and replace function to replace the filename
"MyImage.JPG" with the names of the other files I needed to process. This
procedure might work for you. If your images are in different folders
you'll need to change folders as well. For example if I needed to process
an image named YourImage.JPG in a folder titled "YourFolder" that was on my
Desktop, I woud edit the command to make it look like this
open("/Users/willashby/Desktop/YourFolder/YourImage.JPG");
Of course there are more elegant ways of processing batches of images but it
would take a while to explain. The BatchConvert.txt macro found in the
ImageJ\Macros\folder is an example of this.
Good Luck,
Will Ashby
Vanderbilt University
Nashville, TN, USA
On 10/8/09 9:49 AM, "Will Ashby" <
[hidden email]> wrote:
> If you used the macro recorder, then you're macro should have a line similar
> to this.
> open("/Users/willashby/Desktop/MyImage.JPG");
>
> If it doesn't make sure you use the open command to open your images rather
> than dragging and dropping them onto ImageJ which results in this.
> selectWindow("MyImage-1.JPG");
> This command won't open images when you run a macro.
>
> When I started doing macros in ImageJ, I would record what I needed done using
> the recorder, create a macro from that, save it, and then open it in a
> texteditor. Using the texteditor, I would copy the macro as many times as I
> needed then use the find and replace function to replace the filename
> "MyImage.JPG" with the names of the other files I needed to process. This
> procedure might work for you.
>
> Of course there are more elegant ways of processing batches of images but it
> would take a while to explain. The BatchConvert macro found in the
> ImageJ\Macros\folder is a good example of this.
>
> Good Luck,
> Will Ashby
> Vanderbilt University
> Nashville, TN, USA
>
> On 10/8/09 8:33 AM, "Virginia Borroni" <
[hidden email]> wrote:
>
>> Hi,
>> When I run a macro, it only works with the images I used to create it.
>> When I try to run the macro in another images (with different names)
>> it doesn't run and a legend appear telling me that the image is not
>> open. How can I edit the macro in the way it can run with any image? I
>> don't know anything about programing!!!
>> Thanks a lot!!!
>> Virginia
>>
>>
>>
>>
>> Dra. Maria Virginia Borroni
>> INIBIBB
>> C La Carrindanga Km 7 CC857. B8000FWB.
>> Bahia Blanca. Buenos Aires. Argentina.
>> Tel.#: 54-291-4861201. interno 127
>> Fax#: 54-291-4861200
>>
[hidden email]
>>
>>
>> ----------------------------------------------------------------
>> This message was sent using IMP, the Internet Messaging Program.