コード例 #1
0
 /** Runs a command in the Plugins/Macros submenu on the current thread. */
 public static boolean runMacroCommand(String name) {
   if (instance == null) return false;
   // IJ.log("runMacroCommand: "+name+" "+instance.nMacros);
   if (name.startsWith(commandPrefixS)) name = name.substring(1);
   for (int i = 0; i < instance.nMacros; i++) {
     // IJ.log("  "+i+" "+instance.macroNames[i]);
     if (name.equals(instance.macroNames[i])) {
       MacroRunner mm = new MacroRunner();
       mm.run(instance.pgm, instance.macroStarts[i], name);
       return true;
     }
   }
   return false;
 }
コード例 #2
0
 public boolean runMacroTool(String name) {
   for (int i = 0; i < nMacros; i++) {
     if (macroNames[i].startsWith(name)) {
       if (macroToolThread != null
           && macroToolThread.getName().indexOf(name) != -1
           && macroToolThread.isAlive())
         return false; // do nothing if this tool is already running
       MacroRunner mw = new MacroRunner(pgm, macroStarts[i], name, (String) null);
       macroToolThread = mw.getThread();
       // IJ.log("runMacroTool: "+macroToolThread);
       return true;
     }
   }
   return false;
 }