hasWindow always returns False

Asked by Michael

Hi!

I am writing a basic script and want to print some information about my app, like isRunning(), getPID() etc. Everything works fine until hasWindow() is run, after that getPID returns -1 and isRunning() returns False. Here's my code and the output:

calc = App("myApp")
calc.open()
print 'Running: ' + str(calc.isRunning())
print 'Window title: ' + str(calc.getWindow())
print 'PID: ' + str(calc.getPID())
print 'Name: ' + calc.getName()
print 'Has window: ' + str(calc.hasWindow())
print 'Running: ' + str(calc.isRunning())
print 'Window title: ' + str(calc.getWindow())
print 'PID: ' + str(calc.getPID())
print 'Name: ' + calc.getName()

Output:

[log] App.open [23902:myApp]
Running: True
Window title:
PID: 23902
Name: myApp
Has window: False
Running: False
Window title:
PID: -1
Name: myApp

What causes this problem? Is something wrong with hasWindow()?

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

SikuliX version?

System version?

Revision history for this message
Michael (michaeljohnson) said :
#2

I'm using Linux and SikuliX version 1.1.0.

I checked some source files on git and realized that hasWindow() returns false because getWindow() returns "". I think? I still don't understand why getPID() returns -1 and isRunning() returns False though.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

possible to check the situation with latest 1.1.1?

Revision history for this message
Michael (michaeljohnson) said :
#4

Ok, I will try it as soon as I can and report back to you.

Revision history for this message
Michael (michaeljohnson) said :
#5

I downloaded version 1.1.1 and got the same problematic result.

Revision history for this message
Michael (michaeljohnson) said :
#6

Changing status to information provided.

Revision history for this message
masuo (masuo-ohara) said :
#7

If the first started process has been completed after a few seconds and another process is running, such a phenomenon occurs .
It is necessary to confirm whether this phenomenon occurs regardless of hasWindow.

[example:]
calc = App("myApp")
calc.open()
sleep(5)
print 'Running: ' + str(calc.isRunning())

Revision history for this message
larryli (larryli2020) said :
#8

Now, I use 2.0.2 windows environemnt, make one test

myApp = App("C:\\Windows\\system32\\Notepad.exe")
myApp.open()
sleep(5)
print myApp.hasWindow()

it always false, notepad already opened.
which part has problem?
thanks

Can you help with this problem?

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

To post a message you must log in.