// Queued Macros // // This macro set demonstrates how to ovoid overlapping // macro execution by setting the "QueueMacros" option. // // Steps to test: // // 1. Press ctrl-i (Macros>Install Macros) to install // the macros. The Log window will open. // 2. Activate the ImageJ window. // 3. Type "12" to run both macros. // 4. 1-2-3 is displayed in the Log window, indicating // that the macros ran in succession. // // Change 'true' to 'false' in setOption("QueueMacros", true), // repeat the first three steps, and notice that 1-3-2 is displayed // in the Log window, indicating that the macros ran concurrently. // // Note that the "QueueMacros" option does not work with macros // using function key shortcuts in ImageJ 1.41g and earlier. var xx = setup(); // runs when macros are installed function setup() { setOption("QueueMacros", true); print("\\Clear"); return true; } // macro with keyboard shortcut of "1" macro "aa [1]"{ print(1); wait(1000); print(2); } // macro with keyboard shortcut of "2" macro "bb [2]"{ print(3); }