ij.plugin
Class Macro_Runner

java.lang.Object
  extended by ij.plugin.Macro_Runner
All Implemented Interfaces:
PlugIn

public class Macro_Runner
extends java.lang.Object
implements PlugIn

Opens and runs a macro file.


Constructor Summary
Macro_Runner()
           
 
Method Summary
 void run(java.lang.String name)
          Opens and runs the specified macro file, which is assumed to be in the plugins folder, on the current thread.
 java.lang.String runJavaScript(java.lang.String script, java.lang.String arg)
          Runs a script on the current thread, passing 'arg', which the script can retrieve using the getArgument() function.
 java.lang.String runMacro(java.lang.String macro, java.lang.String arg)
          Opens and runs the specified macro on the current thread.
 java.lang.String runMacroFile(java.lang.String name, java.lang.String arg)
          Opens and runs the specified macro file on the current thread.
 java.lang.String runMacroFromIJJar(java.lang.String name, java.lang.String arg)
           
static java.lang.String runMacroFromJar(java.lang.String name, java.lang.String arg)
          Runs the specified macro from a JAR file in the plugins folder, passing it the specified argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Macro_Runner

public Macro_Runner()
Method Detail

run

public void run(java.lang.String name)
Opens and runs the specified macro file, which is assumed to be in the plugins folder, on the current thread. Displays a file open dialog if name is an empty string.

Specified by:
run in interface PlugIn

runMacroFile

public java.lang.String runMacroFile(java.lang.String name,
                                     java.lang.String arg)
Opens and runs the specified macro file on the current thread. The file is assumed to be in the macros folder unless name is a full path. ".txt" is added if name does not have an extension.


runMacro

public java.lang.String runMacro(java.lang.String macro,
                                 java.lang.String arg)
Opens and runs the specified macro on the current thread. Macros can retrieve the optional string argument by calling the getArgument() macro function. Returns the String value returned by the macro, null if the macro does not return a value, or "[aborted]" if the macro was aborted due to an error.


runMacroFromJar

public static java.lang.String runMacroFromJar(java.lang.String name,
                                               java.lang.String arg)
Runs the specified macro from a JAR file in the plugins folder, passing it the specified argument. Returns the String value returned by the macro, null if the macro does not return a value, or "[aborted]" if the macro was aborted due to an error. The macro can reside anywhere in the plugins folder, in or out of a JAR file, so name conflicts are possible. To avoid name conflicts, it is a good idea to incorporate the plugin or JAR file name in the macro name (e.g., "Image_5D_Macro1.ijm").


runMacroFromIJJar

public java.lang.String runMacroFromIJJar(java.lang.String name,
                                          java.lang.String arg)

runJavaScript

public java.lang.String runJavaScript(java.lang.String script,
                                      java.lang.String arg)
Runs a script on the current thread, passing 'arg', which the script can retrieve using the getArgument() function.