File: StartupRunner.java

package info (click to toggle)
imagej 1.54g-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,520 kB
  • sloc: java: 132,209; sh: 286; xml: 255; makefile: 6
file content (32 lines) | stat: -rw-r--r-- 831 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package ij.macro;
import ij.IJ;
import ij.plugin.MacroInstaller;
import ij.plugin.Startup;

/** Runs the RunAtStartup (created by Edit/Options/Startup) and AutoRun (in StartupMacros) macros. */
public class StartupRunner implements Runnable {

	/** Runs the RunAtStartup and AutoRun macros, on the current thread
		if 'batchMode' true, otherwise on a separate thread. */
	public void run(boolean batchMode) {
		if (IJ.debugMode) IJ.log("StartupRunner: "+batchMode);
		if (batchMode)
			run();
		else {
			Thread thread = new Thread(this, "StartupRunner");
			thread.start();
		}
	}

	public void run() {
 		String macro = (new Startup()).getStartupMacro();
 		if (macro!=null && macro.length()>4) {
 			if (macro.contains("setForegroundColor"))
 				IJ.wait(100);
 			IJ.runMacro(macro);
 		}
		MacroInstaller.autoRun();
 	}
 	
}