use of org.sikuli.script.App in project sakuli by ConSol.
the class Application method focusWindow.
/**
* focus a specific window of the application.
*
* @param windowNumber indemnifies the window
* @return this {@link Application}.
*/
@LogToResult(message = "focus application in window")
public Application focusWindow(Integer windowNumber) {
LOGGER.debug("Focus window \"" + windowNumber + "\" in application \"" + getName() + "\".");
App app = super.focus(windowNumber);
sleep(sleepMillis);
if (app == null) {
LOGGER.warn("Application '{}' could not be focused! ... Please check if the application has been opened before or is already focused!", getName());
return this;
}
return this;
}
use of org.sikuli.script.App in project sakuli by ConSol.
the class Application method open.
/**
* Opens the created application. For loadtime intensiv application change the default sleep time with {@link
* #setSleepTime(Integer)}.
*
* @return this {@link Application}.
*/
@LogToResult(message = "open application")
@Override
public Application open() {
App app = super.open();
sleep(sleepMillis);
if (app == null) {
loader.getExceptionHandler().handleException("Application '" + getName() + " could not be opend! ... Please check the application name or path!", resumeOnException);
return null;
}
final int tries = 5;
for (int i = 0; i < tries && this.getPID() <= 0; i++) {
LOGGER.info("wait {} ms more for finish loading application {} - {} of {} tries", sleepMillis, this.getName(), i, tries);
sleep(sleepMillis);
}
LOGGER.info("\"{}\" - PID: {}", this.getName(), this.getPID());
return this;
}
Aggregations