How to use the ahk.window.WindowNotFoundError function in ahk

To help you get started, we’ve selected a few ahk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spyoungtech / ahk / tests / unittests / test_win_get.py View on Github external
def test_win_close():
    p = None
    try:
        p = subprocess.Popen('notepad')
        time.sleep(1)  # give notepad time to start up
        win = ahk.win_get(title='Untitled - Notepad')
        assert win
        assert win.position
        win.close()
        with pytest.raises(WindowNotFoundError):
            ahk.win_get(title='Untitled - Notepad').position
    finally:
        if p is not None:
            p.terminate()
github spyoungtech / ahk / ahk / window.py View on Github external
def _get_pos(self):
        script = self._render_template('window/win_position.ahk')
        resp = self.engine.run_script(script)
        try:
            value = ast.literal_eval(resp)
            return value
        except SyntaxError:
            raise WindowNotFoundError('No window found')