/** * tries to identify a running app with name and if not running tries to open it and tries to make it the foreground * application bringing its topmost window to front * * @param appName name * @return the App instance or null on failure */ public static App focus(String appName) { return focus(appName, 0); }
/** * tries to make it the foreground application bringing its topmost window to front * * @return the App instance or null on failure */ public App focus() { if (appPID > -1) { init(appPID); } return focus(0); }
/** * tries to identify a running app with name and if not running tries to open it and tries to make it the foreground * application bringing its window with the given number to front * * @param appName name * @param num window * @return the App instance or null on failure */ public static App focus(String appName, int num) { return (new App("+" + appName)).focus(num); }
app = new App(appsMac.get(appType)); if (app.window() != null) { app.focus(); aRegion.wait(0.5); win = app.window(); app.open(); win = app.waitForWindow(); app.focus(); aRegion.wait(0.5); aRegion.click(win); app = new App(appsWindows.get(appType)); if (app.window() != null) { app.focus(); aRegion.wait(0.5); win = app.window(); app.open(); win = app.waitForWindow(); app.focus(); aRegion.wait(0.5); aRegion.click(win); app = new App(appsWindows.get(appType)); if (app.window() != null) { app.focus(); aRegion.wait(0.5); win = app.window();