> Hi,
> I know there is a very simple solution here, but being very new
> to ImageJ macros I am at a loss for a solution.
>
> I am putting together a macro for batch folder processing a group
> of AVI
> movies that begins by importing the AVI as a stack. I'd like to
> set the
> first and last frame as part of the macro. As a template I started
> with the macro BatchProcessFolders.txt. Here's the relevant code:
>
> function processFile(path) {
> if (endsWith(path, ".avi")) {
> open(path);
>
> I'd like the open to include the first and last frame parameters.
> I also tried using run("AVI...") with the first and last frames
> included
> but also ran into problems there.
Use the File>Import>AVI command with the command recorder
(Plugins>Macros>Record) to generate the needed code. Here is an
example that opens frames 5-10 of an AVI:
run("AVI...", "select=/Users/wayne/video.avi first=5 last=10");
Use string concatenation to make the file name, first frame and last
frame variables:
name = "video.avi";
path = getDirectory("home")+"video.avi";
first=5; last=10;
run("AVI...", "select="+path+" first="+first+" last="+last);
Note that the file path needs to be enclosed in square brackets if it
can contain spaces:
path = "["+getDirectory("home")+name+"]";
-wayne