Module ij
Package ij.plugin

# Class MacroInstaller

java.lang.Object
ij.plugin.MacroInstaller

All Implemented Interfaces:
  `MacroConstants`, `PlugIn`, `ActionListener`, `EventListener`

public class MacroInstaller extends Object implements PlugIn, MacroConstants, ActionListener
This plugin implements the Plugins/Macros/Install Macros command. It is also used by the Editor class to install macros in menus and by the ImageJ class to install macros at startup.

## Field Summary

Fields
Modifier and Type
Field
Description
`static final char`
`commandPrefix`
`static final int`
`MAX_MACROS`
`static final int`
`MAX_SIZE`
`static final int`
`XINC`
`static final int`
`YINC`

### Fields inherited from interface ij.macro.MacroConstants

`ABS, ACOS, ARRAY, ARRAY_FUNC, ARRAY_FUNCTION, arrayFunctionIDs, arrayFunctions, ASIN, ATAN, ATAN2, AUTO_UPDATE, BEEP, BIT_DEPTH, BREAK, CALCULATOR, CALIBRATE, CALL, CHANGE_VALUES, CHAR_CODE_AT, CLOSE, COLOR, CONTINUE, COS, D2S, DEBUG, DIALOG, DIV_EQUAL, DO, DO_COMMAND, DO_WAND, DRAW_LINE, DRAW_OVAL, DRAW_RECT, DRAW_STRING, DUMP, ELSE, ENDS_WITH, EOF, EQ, EVAL, EXEC, EXIT, EXP, EXT, FALSE, FILE, FILL, FILL_OVAL, FILL_RECT, FIT, FLOOD_FILL, FLOOR, FOR, FROM_CHAR_CODE, FUNCTION, functionIDs, functions, GET_ARGUMENT, GET_BOOLEAN, GET_BOUNDING_RECT, GET_BOUNDS, GET_COORDINATES, GET_COUNT, GET_CURSOR_LOC, GET_DATE_AND_TIME, GET_DIMENSIONS, GET_DIR, GET_DIRECTORY, GET_DISPLAYED_AREA, GET_FILE_LIST, GET_FONT_LIST, GET_HEIGHT, GET_HISTOGRAM, GET_ID, GET_IMAGE_INFO, GET_INFO, GET_LINE, GET_LIST, GET_LOCATION_AND_SIZE, GET_LUT, GET_METADATA, GET_MIN_AND_MAX, GET_NUMBER, GET_PIXEL, GET_PIXEL_SIZE, GET_PROFILE, GET_RAW_STATISTICS, GET_RESULT, GET_RESULT_LABEL, GET_RESULT_STRING, GET_SLICE_NUMBER, GET_STATISTICS, GET_STRING, GET_STRING_WIDTH, GET_THRESHOLD, GET_TIME, GET_TITLE, GET_VALUE, GET_VERSION, GET_VOXEL_SIZE, GET_WIDTH, GET_ZOOM, GT, GTE, IF, IJ_CALL, IMAGE, INDEX_OF, INVERT, IS, IS_ACTIVE, IS_KEY_DOWN, IS_NAN, IS_OPEN, keywordIDs, keywords, LAST_INDEX_OF, LENGTH_OF, LINE_TO, LIST, LOG, LOGICAL_AND, LOGICAL_OR, LT, LTE, MACRO, MAKE_ARROW, MAKE_ELLIPSE, MAKE_LINE, MAKE_OVAL, MAKE_POINT, MAKE_POLYGON, MAKE_RECTANGLE, MAKE_ROTATED_RECT, MAKE_SELECTION, MAKE_TEXT, MATCHES, MATH, MAX_OF, MIN_OF, MINUS_EQUAL, MINUS_MINUS, MOVE_TO, MUL_EQUAL, NaN, NEQ, NEW_ARRAY, NEW_IMAGE, NEW_MENU, NIMAGES, NOP, NRESULTS, NSLICES, NUMBER, NUMERIC_FUNCTION, numericFunctionIDs, numericFunctions, OPEN, OVERLAY, PARSE_FLOAT, PARSE_INT, PI, PLOT, PLUS_EQUAL, PLUS_PLUS, POW, PREDEFINED_FUNCTION, PRINT, PROPERTY, PUT_PIXEL, RANDOM, RENAME, REPLACE, REQUIRES, RESET, RESET_MIN_MAX, RESET_THRESHOLD, RESTORE_PREVIOUS_TOOL, RESTORE_SETTINGS, RETURN, ROI, ROI_MANAGER, ROI_MANAGER2, ROUND, RUN, RUN_MACRO, SAVE, SAVE_AS, SAVE_SETTINGS, SCREEN_HEIGHT, SCREEN_WIDTH, SELECT, SELECT_IMAGE, SELECTION_CONTAINS, SELECTION_NAME, SELECTION_TYPE, SET_AUTO_THRESHOLD, SET_BACKGROUND, SET_BATCH_MODE, SET_COLOR, SET_FONT, SET_FOREGROUND, SET_JUSTIFICATION, SET_KEY_DOWN, SET_LINE_WIDTH, SET_LOCATION, SET_LUT, SET_METADATA, SET_MIN_MAX, SET_OPTION, SET_PASTE_MODE, SET_PIXEL, SET_RESULT, SET_RGB_WEIGHTS, SET_SELECTION_LOC, SET_SELECTION_NAME, SET_SLICE, SET_THRESHOLD, SET_TOOL, SET_VOXEL_SIZE, SET_Z_COORDINATE, SETUP_UNDO, SHIFT_LEFT, SHIFT_RIGHT, SHOW_MESSAGE, SHOW_MESSAGE_WITH_CANCEL, SHOW_PROGRESS, SHOW_STATUS, SHOW_TEXT, SIN, SNAPSHOT, SPLIT, SQRT, STACK, STARTS_WITH, STRING, STRING_CONSTANT, STRING_FUNCTION, stringFunctionIDs, stringFunctions, SUBSTRING, TABLE, TAN, TO_BINARY, TO_HEX, TO_LOWER_CASE, TO_SCALED, TO_STRING, TO_UNSCALED, TO_UPPER_CASE, TOK_MASK, TOK_SHIFT, TOOL_ID, TRIM, TRUE, UPDATE_DISPLAY, UPDATE_RESULTS, USER_FUNCTION, VAR, VARIABLE_FUNCTION, variableFunctionIDs, variableFunctions, WAIT, WAIT_FOR_USER, WHILE, WORD, WRITE`

## Constructor Summary

Constructors
Constructor
Description
`MacroInstaller()`

## Method Summary

Modifier and Type
Method
Description
`void`
`actionPerformed(ActionEvent evt)`
`static void`
`autoRun()`
Runs the StartupMacros AutoRun macro on the current thread.
`static String`
`getFileName()`
`int`
`getMacroCount()`
`Program`
`getProgram()`
`int`
`install(String text)`
`int`
`install(String text, Menu menu)`
`void`
`installFile(String path)`
`void`
`installFromIJJar(String path)`
Installs a macro set contained in ij.jar.
`static void`
`installFromJar(String path)`
Installs a macro set contained in ij.jar.
`void`
`installLibrary(String path)`
`void`
`installSingleTool(String text)`
`void`
`installStartupMacros(String path)`
Installs startup macros and runs AutoRun macro on current thread.
`void`
`installTool(String path)`
`boolean`
`isAutoRunAndHide()`
Returns true if an "AutoRunAndHide" macro was run/installed.
`static boolean`
`isMacroCommand(String name)`
Returns 'true' if the macro command 'name' exists.
`String`
`openFromIJJar(String path)`
Returns a text file contained in ij.jar.
`void`
`run(String path)`
This method is called when the plugin is loaded.
`void`
`runMacro(String name)`
`void`
`runMacro(String name, Editor editor)`
`static boolean`
`runMacroCommand(String name)`
Runs a command in the Plugins/Macros submenu on the current thread.
`static void`
`runMacroShortcut(String name)`
`boolean`
`runMacroTool(String name)`
`boolean`
`runMenuTool(String name, String command)`
`void`
`setFileName(String fileName)`
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### MAX_SIZE

public static final int MAX_SIZE

See Also:
  - Constant Field Values

### MAX_MACROS

public static final int MAX_MACROS

See Also:
  - Constant Field Values

### XINC

public static final int XINC

See Also:
  - Constant Field Values

### YINC

public static final int YINC

See Also:
  - Constant Field Values

### commandPrefix

public static final char commandPrefix

See Also:
  - Constant Field Values

## Constructor Details

### MacroInstaller

public MacroInstaller()

## Method Details

### run

public void run(String path)
Description copied from interface: `PlugIn`
This method is called when the plugin is loaded. 'arg', which may be blank, is the argument specified for this plugin in IJ_Props.txt.

Specified by:
  `run` in interface `PlugIn`

### install

public int install(String text)

### install

public int install(String text, Menu menu)

### installFile

public void installFile(String path)

### installTool

public void installTool(String path)

### installLibrary

public void installLibrary(String path)

### installFromJar

public static void installFromJar(String path)
Installs a macro set contained in ij.jar.

### installFromIJJar

public void installFromIJJar(String path)
Installs a macro set contained in ij.jar.

### installSingleTool

public void installSingleTool(String text)

### openFromIJJar

public String openFromIJJar(String path)
Returns a text file contained in ij.jar.

### runMacroTool

public boolean runMacroTool(String name)

### runMenuTool

public boolean runMenuTool(String name, String command)

### runMacroCommand

public static boolean runMacroCommand(String name)
Runs a command in the Plugins/Macros submenu on the current thread.

### isMacroCommand

public static boolean isMacroCommand(String name)
Returns 'true' if the macro command 'name' exists.

### runMacroShortcut

public static void runMacroShortcut(String name)

### runMacro

public void runMacro(String name)

### runMacro

public void runMacro(String name, Editor editor)

### getMacroCount

public int getMacroCount()

### getProgram

public Program getProgram()

### isAutoRunAndHide

public boolean isAutoRunAndHide()
Returns true if an "AutoRunAndHide" macro was run/installed.

### setFileName

public void setFileName(String fileName)

### getFileName

public static String getFileName()

### actionPerformed

public void actionPerformed(ActionEvent evt)

Specified by:
  `actionPerformed` in interface `ActionListener`

### installStartupMacros

public void installStartupMacros(String path)
Installs startup macros and runs AutoRun macro on current thread.

### autoRun

public static void autoRun()
Runs the StartupMacros AutoRun macro on the current thread.

### toString

public String toString()

Overrides:
  `toString` in class `Object`