/** * runs a named (existing) macro * * @param view The view to run the script in. * @param name The name of the node item * @param path The node content giving the internal name or full path of the macro. */ public static void runNamedMacro(View view, String name, String path) { Log.log( Log.DEBUG, XScripter.class, "Running runNamedMacro for item named = " + name + ", path=" + path); // NOTE: old-style macro names if (path.startsWith("play-macro@")) { path = path.substring(11); } Macros.Macro macro = Macros.getMacro(path); if (macro != null) { // NOTE: this is the internal representation of a macro macro.invoke(view); } else { // NOTE: this is the alternative representation: the macro's full path File macroFile = new File(path); if (macroFile.exists()) { BeanShell.runScript(view, path, null, true); } else { Log.log(Log.ERROR, XScripter.class, "Could not find macro named " + path); } } } // }}}