Login  Register

Re: Accessing Files

Posted by Nathaniel Ryckman on Jun 09, 2011; 10:42pm
URL: http://imagej.273.s1.nabble.com/Accessing-Files-tp3684260p3684261.html

That's not so much an imageJ question as it is a Java question. You should convert your macro into a plugin and then read these following articles/commentary/documents:

http://www.exampledepot.com/egs/java.nio/SetFileLock.html
http://stackoverflow.com/questions/128038/how-can-i-lock-a-file-using-java-if-possible
http://download.oracle.com/javase/6/docs/api/java/nio/channels/FileChannel.html#lock()

Oh! I suddenly had another idea that would take less work. Create a plugin or stand alone java program that would update the file shared file with the macro output. So, the pipeline would look like this:

Macro creates file1.txt -> Plugin updates file2.txt (shared file) using data in file1.txt.

Good luck!

bds81175 wrote
I have a macro program that I need to access a text or csv file that other PC's may be accessing and writing to.  Is there a way to either open it read-only or wait for the other user to finish and try again?