Programming in imagej

I have written a code for calculating the area using macros in ImageJ. But I have hundreds of similar images in the file. The code works for all the images when I process them individually. Can this work be automated so that I can input a given stack of images and all the areas of respective frames are displayed?

Have a look at the batch processing function of ImageJ:

thanks, @Bio7 for the help

I followed your advice and performed batch processing on my code. It worked beautifully for all the files. But the problem is I need to find a way to segregate my results.
I mean for my problem each file contains 2 images of bubbles whose information i am finding using my script. But their are nearly thousand such files. So when i do batch processing It simply gives me the results one after the other. i have to manually find which result corresponds to which file. Can u suggest me a method to automate this process and store the results in an xls format.

There are multiple examples in the archives, e.g.:

But it highly depends on your macro.

Thanks once again for your help.