Skip to content

AHKExecutionException is raised with ahk.active_window #365

@michaelmesser

Description

@michaelmesser

describe your issue

ahk.active_window

file.python-ahk-3w1o_2fn.ahk (534) : [WinGetID] output := WinGetID(title, text, extitle, extext)
file.python-ahk-3w1o_2fn.ahk (534) : [AHKWinGetID] output := WinGetID(title, text, extitle, extext)
file.pyresp := %func_name%(argsArray*)
> Auto-execute

Unsure how to consistently reproduce. The stack track is all I have.

ahk.version

2.0.11

AutoHotkey version

v2

Code to reproduce the issue

Traceback/Error message

Traceback (most recent call last):
  File "file.py", line 104, in infer_active_path
    if ahk.active_window is None:
       ^^^^^^^^^^^^^^^^^
  File "file.py", line 819, in active_window
    return self.get_active_window()
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "file.py", line 810, in get_active_window
    return self.win_get(
           ^^^^^^^^^^^^^
  File "file.py", line 1762, in win_get
    resp = self._transport.function_call('AHKWinGetID', args, blocking=blocking, engine=self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "file.py", line 531, in function_call
    return self.send(request, engine=engine)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "file.py", line 744, in send
    return response.unpack()  # type: ignore
           ^^^^^^^^^^^^^^^^^
  File "file.py", line 216, in unpack
    raise self._exception_type(s)
ahk.exceptions.AHKExecutionException: Error occurred in WinGetID (line 534). The error message was: Target window not found.. Specifically: A
Stack:
file.python-ahk-3w1o_2fn.ahk (534) : [WinGetID] output := WinGetID(title, text, extitle, extext)
file.python-ahk-3w1o_2fn.ahk (534) : [AHKWinGetID] output := WinGetID(title, text, extitle, extext)
file.pyresp := %func_name%(argsArray*)
> Auto-execute

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions