← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #231485]: What kind of error is raised when App.focus fails?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
App.focus() does not raise exceptions.

If it fails, it returns null/None, outherwise the App object.

This should work:

from subprocess import Popen
#try to focus on an app
if not  App.focus('Login'):
    # use Popen if the app is not found
    Popen([r'path to some app',], )

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