How to Get the PID or name of focused App?

Asked by Gabriel Nogueira on 2018-02-07

Hi everyone.

I'm learning sikuli now and need some help.

I'm using sikulixapi for Java.

I Need to get the App that is in focus and listen when the user change the focus to another app.

I'm trying this way:

while(true){
     App.focusedWindow();
}

This way, i get the Region of app in focus, and when the user changes, i get the new Region.

But there is a way to get the App instance by a Region?

In my project, i have to learn some data from app in screen by OCR, process and save this data by App instance. I will show the result to the user on screen when he focus the App again.

User can manage many instances of the App, with the same visual. (Like many Untitled Notepads). I have to do something to identify wich instance is in focus (like PID) and show the correct information processed before.

Some idea?

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-02-07
Last reply:
2018-02-08
RaiMan (raimund-hocke) said : #1

Sorry, not a feature of SikuliX currently.

... but look:
https://answers.launchpad.net/sikuli/+question/664004

Can you help with this problem?

Provide an answer of your own, or ask Gabriel Nogueira for more information if necessary.

To post a message you must log in.