Hi Gary,
just a thought, not any definitive answer:
Could it be that you close a file and then write a file with the same name rapidly in succession?
It may depend on details how the file was open before, but some file operations may be done asynchronously while the program continues. Then closing the old file would not be finished at the time when you want to write a new file with the same name.
If this is the case, and as it seems that you are working on a temporary file, maybe you can switch between two different file names? E.g. close file Blue1.tif, then write Blue2.tif, close Blue2.tif and write Blue1.tif. Or do the same with two different directories temp1 and temp2.
Michael
________________________________________________________________
On Dec 2, 2015, at 12:21, gary.chien wrote:
> Hi,
> I got a problem in in running my Macro
> A window showed up as following:
>
> FileSaver.saveAsTiff.
> File saving error(IOException):
> D:\Sample\temp\Blue.tif("File can not be opened, because it is already in
> use")(translated from Mandarin)
> D:\Sample\temp\Blue.tif
>
> path:D:\Sample\temp
> file:Blue.tif
>
> But the error showed up sometimes! (randomly about 10%)
> I just wounder if the Macro might go wrong if it reads and opens too
> frequently, because it runs successfully in most of the time...
> Any suggestion will be appreciated.
>
> BRs
>
> Gary
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html