Sikuli often sees App class as isRunning == True

Asked by Artem Koval on 2020-02-16

System: Win 10, Sikuli 2.0.1

I have issues with isRunning() check. For example when using this code:
myApp=App('full-path-to-executable)
if myApp.isRunning() == True:
    print 'App found'
else:
    print 'App not found'

It works correctly most of the time, but it is not reliable. If I work some time with my application, quit and check whether it is present in Task Manager's processes, then the code instantly returns that the app is found/running. And the only thing I can do is to perform a system restart.

What can be causing this and how can I prevent this? As a workaround I currently use App.focus() + hasWindow()

Question information

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

this worked for me:

appFolder = r"C:\Program Files\Notepad++"
appName = "notepad++.exe"
np = App(appFolder + "\\" + appName)

if np.isRunning():
  popup("running")
  exit()

np.open()
popup("wait for notepad++")
np = App.getApps(appName)[0]
popup("please close app\nwait until notepad++ terminated")
print App.getApps(appName) # should be an empty list

Can you help with this problem?

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

To post a message you must log in.