Troulbe finding the screen # from App.focusedWindow?

Asked by Sam

I'm simply trying to find the screen number that I am focused on.

PathChrome = "C:\Users\staffos\AppData\Local\Google\Chrome\Application\chrome.exe"

firstWindow = App.focusedWindow()

firstwindow = str(firstWindow)
print firstWindow
#firstWindow = "R[-1600,0 1600x900]@S(1)[-1600,0 1600x900] E:Y, T:3.0" # this works when put in manually
screenNum = firstWindow[firstWindow.find("(")+1:firstWindow.find(")")]
print screenNum

I can print firstWindow just fine. I can even search it's text just fine when I put it in manually, but for whatever reason I can't seem to get the code to work.

Any insight is appreciated. Thank you

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

firstWindow = App.focusedWindow()
screenNum = firstWindow.getScreen().getID()

Can you help with this problem?

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

To post a message you must log in.