0

Most of the code below is from a ImageJ template, with only the last 6 lines being custom-made. The purpose is to choose only certain frames in a video, and export the smaller video as .avi. I wish to batch-process this. However, the last piece of code (that saves the video) doesn't seem to work... any ideas?

input = getDirectory("Input directory");
output = getDirectory("Output directory");

Dialog.create("File type");
Dialog.addString("File suffix: ", ".avi", 5);
Dialog.show();
suffix = Dialog.getString();

processFolder(input);

function processFolder(input) {
    list = getFileList(input);
    for (i = 0; i < list.length; i++) {
        if(File.isDirectory(input + list[i]))
            processFolder("" + input + list[i]);
        if(endsWith(list[i], suffix))
            processFile(input, output, list[i]);
    }
}

function processFile(input, output, file) {
    open(input + file);
    run("Make Substack...", "  slices=1-293-5");
    run("AVI... ", "compression=None frame=1.96 save=&output+&file");
    close();
    close();
}
Jan Eglinger
  • 3,995
  • 1
  • 25
  • 51
J. Park
  • 1
  • 1

1 Answers1

0
run("AVI... ", "compression=None frame=1.96 save=&output+&file");

You should use proper string concatenation here:

run("AVI... ", "compression=None frame=1.96 save=" + output + file);
Jan Eglinger
  • 3,995
  • 1
  • 25
  • 51
  • Thank you! It didn't work right away, but we got enough hint that we were able to tweak it and make it work. The final code was run("AVI... ", "compression=None frame=1.96 save=[" + output + file + "]"); – J. Park Jun 21 '16 at 21:08