File Open Macro Help

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

File Open Macro Help

doyleti
I am a new imageJ user.  I am trying to write a macro to open a series of individual files.  When I simply recorded a macro it put the directory path in the format C:\\Temp\\SubDir\\file.bmp

If I use the getDirectory command in the macro and then use the dialog box to select the same directory, the format is the conventional C:\Temp\SubDir\

I can subsequently get a list of files or other directory information but when I use the open command

open(dir1 + list[i]) the file does not open

Could someone explain to me how I can get the double slashes if I use the macro or if there is something else going on?  This seems like it should be simple.

Thank you,

Tim

Here is the actual code

dir1 = getDirectory("Choose Source Directory ");
list = getFileList(dir1);
  setBatchMode(true);
  for (i=0; i<list.length/2; i++) {
     open(dir1+list[i]);
     open(dir1+list[i+list.length/2]);
      }  

Reply | Threaded
Open this post in threaded view
|

Re: File Open Macro Help

doyleti
This post was updated on .
Please Disregard.  I realized that batchmode set to true was causing the problem.  I am still confused why the double slashes show up when you record the file open command as a macro, but that is a separate issue.
Reply | Threaded
Open this post in threaded view
|

Re: File Open Macro Help

Nathaniel Ryckman
The slash has special meaning in most programming languages. The slash is a computer command itself.

In order to distinguish between the slash command and the slash character, programmers use "//" instead of just "/".

You can read more about it here:

http://en.wikipedia.org/wiki/Escape_character

doyleti wrote
Please Disregard.  I realized that batchmode set to true was causing the problem.  I am still confused why the double slashes show up when you record the file open command as a macro, but that is a separate issue.