Class Macro_Runner
java.lang.Object
ij.plugin.Macro_Runner
- All Implemented Interfaces:
PlugIn
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleandownloadJar(String url) static StringReturns the file path of the most recently loaded macro or script.voidOpens and runs the specified macro file (.txt or .ijm) or script file (.js, .bsh or .py) on the current thread.static StringrunBeanShell(String script, String arg) Runs a BeanShell script on the current thread, passing a string argument, which the script can retrieve using the getArgument() function.runJavaScript(String script, String arg) Runs a JavaScript script on the current thread, passing a string argument, which the script can retrieve using the getArgument() function.Runs the specified macro on the current thread.runMacroFile(String name, String arg) Opens and runs the specified macro or script on the current thread.runMacroFromIJJar(String name, String arg) static StringrunMacroFromJar(String name, String arg) Runs the specified macro from a JAR file in the plugins folder, passing it the specified argument.static StringRuns a Python script on the current thread, passing a string argument, which the script can retrieve using the getArgument() function.static voidsetFilePath(String path)
-
Constructor Details
-
Macro_Runner
public Macro_Runner()
-
-
Method Details
-
run
Opens and runs the specified macro file (.txt or .ijm) or script file (.js, .bsh or .py) on the current thread. Displays a file open dialog ifnameis an empty string. The macro or script is assumed to be in the ImageJ plugins folder ifnameis not a full path. -
runMacroFile
-
runMacro
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
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
-
runJavaScript
-
runBeanShell
Runs a BeanShell script on the current thread, passing a string argument, which the script can retrieve using the getArgument() function. Returns, as a string, the last expression evaluated by the script. Uses the plugin at http://imagej.net/ij/plugins/bsh/ to run the script. -
runPython
Runs a Python script on the current thread, passing a string argument, which the script can retrieve using the getArgument() function. Returns, as a string, the value of the variable 'result'. For example, a Python script containing the line "result=123" will return the string "123". Uses the plugin at http://imagej.net/ij/plugins/jython/ to run the script. -
downloadJar
-
getFilePath
Returns the file path of the most recently loaded macro or script. -
setFilePath
-