← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #698000]: Unable to bring window forward on Windows 10

 

Question #698000 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/698000

    Status: Answered => Open

Jeff Harmon is still having a problem:
I am still having trouble with this.  In Java this works if the
application isn't open or with the first call, but it fails very
regularly after that.  I am also having trouble getting anything in the
debug logs.

Here is the java code:

    public static void main(String[] args) {
        Debug.setLogFile("C:\\Users\\Jeff\\SikulixDebug.log");
        Debug.on(3);
        String appName = "\"C:\\Program Files (x86)\\Notepad++\\notepad++.exe\"";
        App test = new App(appName);
        boolean opened = test.open();
        test.focus();
        if (!opened || !test.hasFocus()) {
            System.err.println("test: Failed to open "+appName+", opened="+opened+",hasFocus="+test.hasFocus());
        } else {
            System.out.println("test: Successfully opened " + appName);
        }

        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        test = new App(appName);
        opened = test.open();
        test.focus();
        if (!opened || !test.hasFocus()) {
            System.err.println("test: Failed to open "+appName+", opened="+opened+",hasFocus="+test.hasFocus());
        } else {
            System.out.println("test: Successfully opened " + appName);
        }


Here is the log from the above:

test: Successfully opened "C:\Program Files (x86)\Notepad++\notepad++.exe"
test: Failed to open "C:\Program Files (x86)\Notepad++\notepad++.exe", opened=true,hasFocus=false

The SikulixDebug.log file is created at C:\User\Jeff\SikulixDebug.log
but is empty

The use case for me is that I need to make sure the app is in focus
multiple times and it fails more than it works.

Java 11, Sikulix API  2.0.5

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.