Window¶
-
class
ahk.window.
AsyncWindow
(engine, ahk_id, encoding=None)[source]¶ -
property
always_on_top
¶ - Return type
bool
-
property
height
¶
-
property
non_max_non_min
¶
-
property
position
¶
-
property
rect
¶
-
property
title
¶
-
property
transparent
¶ - Return type
int
-
property
width
¶
-
property
-
class
ahk.window.
AsyncWindowMixin
(*args, **kwargs)[source]¶ -
async
find_window
(func=None, **kwargs)[source]¶ Like
find_windows
but only returns the first found window- Parameters
func –
kwargs –
- Returns
a
Window
object orNone
if no matching window is found
-
async
find_window_by_class
(*args, **kwargs)[source]¶ - Parameters
args –
kwargs –
- Returns
a
Window
object orNone
if no matching window is found
-
async
find_window_by_text
(*args, **kwargs)[source]¶ - Parameters
args –
kwargs –
- Returns
a
Window
object orNone
if no matching window is found
-
async
find_window_by_title
(title)[source]¶ Like
find_windows_by_title
but only returns the first result.- Returns
a
Window
object orNone
if no matching window is found
-
find_windows
(func=None, **kwargs)[source]¶ Find all matching windows
- Parameters
func – a callable to filter windows
exact (bool) – if False (the default) partial matches are found. If True, only exact matches are returned
kwargs – keywords of attributes of the window (has no effect if
func
is provided)
- Returns
a generator containing any matching
Window
objects.
-
find_windows_by_class
(class_name, exact=False)[source]¶ - Parameters
class_name –
exact –
- Returns
a generator containing any matching
Window
objects.
-
find_windows_by_text
(text, exact=False)[source]¶ - Parameters
text –
exact –
- Returns
a generator containing any matching
Window
objects.
-
find_windows_by_title
(title, exact=False)[source]¶ Equivalent to
find_windows(title=title)`
Note that
title
is abytes
object- Parameters
title (bytes) –
exact –
- Returns
-
async
-
class
ahk.window.
Control
[source]¶ -
-
click
()[source]¶ REF: https://www.autohotkey.com/docs/commands/ControlClick.htm
- Returns
-
focus
()[source]¶ REF: https://www.autohotkey.com/docs/commands/ControlFocus.htm
- Returns
-
get
(key)[source]¶ REF: https://www.autohotkey.com/docs/commands/ControlGet.htm
- Parameters
key –
- Returns
-
move
()[source]¶ REF: https://www.autohotkey.com/docs/commands/ControlMove.htm
- Returns
-
property
position
¶ REF: https://www.autohotkey.com/docs/commands/ControlGetPos.htm
- Returns
-
send
(raw=False)[source]¶ REF: https://www.autohotkey.com/docs/commands/ControlSend.htm
- Parameters
raw –
- Returns
-
property
text
¶ REF: https://www.autohotkey.com/docs/commands/ControlGetText.htm
- Returns
-
-
class
ahk.window.
Window
(engine, ahk_id, encoding=None)[source]¶ -
MAXIMIZED
= '1'¶
-
MINIMIZED
= '-1'¶
-
NON_MIN_NON_MAX
= '0'¶
-
__init__
(engine, ahk_id, encoding=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
activate
()[source]¶ Activate the window.
See also: WinActivate
- Returns
-
activate_bottom
()[source]¶ Calls WinActivateBottom on the window
- Returns
-
property
active
¶
-
property
always_on_top
¶ - Return type
bool
-
property
class_name
¶
-
click
(*args, **kwargs)[source]¶ Click at an x/y location on the screen. Uses ControlClick https://autohotkey.com/docs/commands/ControlClick.htm
x/y position params may also be specified as a 2-item sequence
- Parameters
x – x offset relative to topleft corner of the window
y – y offset relative to the top of the window
button – the button to press (default is left mouse)
n – number of times to click
options – per ControlClick documentation
blocking –
- Returns
-
close
(seconds_to_wait='')[source]¶ Closes the Window. See also: WinClose
- Parameters
seconds_to_wait –
- Returns
-
property
exist
¶
-
property
height
¶
-
property
maximized
¶
-
property
minimized
¶
-
move
(x='', y='', width=None, height=None)[source]¶ Move the window to a position and/or change its geometry
- Parameters
x –
y –
width –
height –
- Returns
-
property
non_max_non_min
¶
-
property
position
¶
-
property
rect
¶
-
send
(keys, delay=10, raw=False, blocking=True, escape=False, press_duration=-1)[source]¶ Send keystrokes directly to the window. Uses ControlSend https://autohotkey.com/docs/commands/Send.htm
-
property
text
¶
-
property
title
¶
-
property
transparent
¶ - Return type
int
-
property
width
¶
-
-
class
ahk.window.
WindowMixin
(*args, **kwargs)[source]¶ -
__init__
(*args, **kwargs)[source]¶ This class is typically not used directly. AHK components inherit from this class and the arguments for this class should usually be passed in to
AHK
.- Parameters
executable_path –
the path to the AHK executable. If not provided explicitly in this argument, the path to the AHK executable is resolved in the following order:
The
AHK_PATH
environment variable, if presentDEFAULT_EXECUTABLE_PATH
if the file exists
If environment variable not present, tries to look for ‘AutoHotkey.exe’ or ‘AutoHotkeyA32.exe’ with shutil.which
directives – a set of directives to apply to all generated AHK scripts
- Raises
ExecutableNotFound – if AHK executable cannot be found or the specified file does not exist
-
property
active_window
¶
-
find_window
(func=None, **kwargs)[source]¶ Like
find_windows
but only returns the first found window- Parameters
func –
kwargs –
- Returns
a
Window
object orNone
if no matching window is found
-
find_window_by_class
(*args, **kwargs)[source]¶ - Parameters
args –
kwargs –
- Returns
a
Window
object orNone
if no matching window is found
-
find_window_by_text
(*args, **kwargs)[source]¶ - Parameters
args –
kwargs –
- Returns
a
Window
object orNone
if no matching window is found
-
find_window_by_title
(*args, **kwargs)[source]¶ Like
find_windows_by_title
but only returns the first result.- Returns
a
Window
object orNone
if no matching window is found
-
find_windows
(func=None, **kwargs)[source]¶ Find all matching windows
- Parameters
func – a callable to filter windows
exact (bool) – if False (the default) partial matches are found. If True, only exact matches are returned
kwargs – keywords of attributes of the window (has no effect if
func
is provided)
- Returns
a generator containing any matching
Window
objects.
-
find_windows_by_class
(class_name, exact=False)[source]¶ - Parameters
class_name –
exact –
- Returns
a generator containing any matching
Window
objects.
-
find_windows_by_text
(text, exact=False)[source]¶ - Parameters
text –
exact –
- Returns
a generator containing any matching
Window
objects.
-
find_windows_by_title
(title, exact=False)[source]¶ Equivalent to
find_windows(title=title)`
Note that
title
is abytes
object- Parameters
title (bytes) –
exact –
- Returns
-