← Back to team overview

sikuli-driver team mailing list archive

[Question #675666]: [1.1.4]How to get all apps with the same name on windows

 

New question #675666 on Sikuli:
https://answers.launchpad.net/sikuli/+question/675666

system: windows 10
situation: There are 5 applications with the same name running on the system. (With different PIDs)

problem:
In version 1.1.2, I can use App("some-text-of-window-title") to get all the windows of the 5 app. But in version 1.1.4, it failed.
If I use APP("app-name-show-in-taskmanager"), it only returns the first app-object.

So , I want to know how can I get All the windows that contains the same keyword in their window titles. My scripts are as follow(It runs well in 1.1.2, but failed to find any windows in 1.1.4):

def getApp(sKeyWord):

    allClient = App("+%s" % sKeyWord)
    clientList = []
    windowList = []
    if not allClient:
        error_message("No client found with title %s" % sKeyWord)
        return clientList, 0, windowList
    iMainWindowIndex = getMainWindowIndex(sKeyWord)
    for i in range(10):
        oneClient = allClient.focus(i)
        #oneClient = allClient
        pid = oneClient.getPID()
        if pid <= 0:
            break
        info_message("========Client:%d pid=%s=============" % (i, pid))
        w = oneClient.window(iMainWindowIndex)
        if not w.isValid():
            continue
        clientList.append(oneClient)
        windowList.append(w)
    info_message("title = %s, client found:%d" % (sKeyWord, len(clientList)))
    return clientList, len(windowList), windowList

getApp("Revision")

result:
in 1.1.2:
[22:37:33][4299:4885] ========Client:0 pid=2932=============
[22:37:33][4299:4885] ========Client:1 pid=1992=============
[22:37:33][4316:4885] title = Revision, client found:2

in 1.1.4:
[error] App.focus failed: not running: [-1:+Revision (???)] +Revision
[22:38:45][4316:4885] title = Revision, client found:0

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