← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #266528]: app.focus() not working after window title change (Windows 8.1)?

 

Question #266528 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/266528

    Status: Open => Answered

RaiMan proposed the following answer:
be aware: the search for the window title with some part of it is now
case sensitive.

a problem?

this is possible now (and is the recommended use and works)

--- open some application, bring it back to front later and close it

# creates an App object and checks, wether this app (theapp.exe) is
already running (no action)

- using the path to the executable
someApp = App("<path to>/theapp.exe")

- using the name of the executable if found on system path (case does not matter) 
someApp = App("notepad.exe")

- using part of the window title of a running app (case sensitive)
someApp = App("Part of the Title Text")

# open the app (if possible), if not already running and bring it to front
someApp.open()

# bring the app to front if it is running, otherwise use open()
someApp.focus()

# terminate the app
someApp.close()

--- additional new features (taken from task list command output)

# get the window title of the app's frontmost window
someApp.getWindow()

# get the process id
someApp.getPID() (-1 for a not running or not found app) 

# get the name of the executable (image name) 
someApp.getName()

--- the other features
openApp("….") is the same as
App.open("….") is the same as
App("….").open()

switchApp("….") is the same as
App.focus("….") is the same as
App("….").focus()

closeApp("….") is the same as
App.close("….") is the same as
App("….").close()

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.