Screen¶
-
class
ahk.screen.
AsyncScreenMixin
(executable_path='', directives=None, **kwargs)[source]¶ -
async
image_search
(*args, **kwargs)[source]¶ AutoHotkey ImageSearch reference
- Parameters
image_path – path to the image file e.g. C:locationofcats.png
upper_bound – a two-tuple of X,Y coordinates for the upper-left corner of the search area e.g. (200, 400) defaults to (0,0)
lower_bound – like
upper_bound
but for the lower-righthand corner of the search area e.g. (400, 800) defaults to screen width and height (lower right-hand corner;%A_ScreenWidth%
,%A_ScreenHeight%
).color_variation – Shades of variation (up or down) for the intensity of RGB for each pixel. Equivalent of
*n
option. Defaults to 0.coord_mode – the Pixel CoordMode to use. Default is ‘Screen’
scale_height – Scale height in pixels. Equivalent of
*hn
optionscale_width – Scale width in pixels. Equivalent of
*wn
optiontransparent – Specific color in the image that will be ignored during the search. Pixels with the exact color given will match any color. Can be used with color names e.g. (Black, Purple, Yellow) found at https://https://www.autohotkey.com/docs/commands/Progress.htm#colors or hexadecimal values e.g. (0xFFFFAA, 05FA15, 632511). Equivalent of
*TransN
optionicon – Number of the icon group to use. Equivalent of
*Icon
option
- Returns
coordinates of the upper-left pixel of where the image was found on the screen;
None
if the image was not found- Return type
Union[Tuple[int, int], None]
Note: when only scale_height or only scale_width are provided, aspect ratio is maintained by default.
-
async
pixel_search
(*args, **kwargs)[source]¶ AutoHotkey PixelSearch reference
- Parameters
color –
variation –
upper_bound –
lower_bound –
coord_mode –
fast –
rgb –
- Returns
the coordinates of the pixel; None if the pixel is not found
-
async
-
class
ahk.screen.
ScreenMixin
(executable_path='', directives=None, **kwargs)[source]¶ -
image_search
(image_path, upper_bound=(0, 0), lower_bound=None, color_variation=None, coord_mode='Screen', scale_height=None, scale_width=None, transparent=None, icon=None)[source]¶ AutoHotkey ImageSearch reference
- Parameters
image_path (
str
) – path to the image file e.g. C:locationofcats.pngupper_bound (
Tuple
[int
,int
]) – a two-tuple of X,Y coordinates for the upper-left corner of the search area e.g. (200, 400) defaults to (0,0)lower_bound (
Optional
[Tuple
[int
,int
]]) – likeupper_bound
but for the lower-righthand corner of the search area e.g. (400, 800) defaults to screen width and height (lower right-hand corner;%A_ScreenWidth%
,%A_ScreenHeight%
).color_variation (
Optional
[int
]) – Shades of variation (up or down) for the intensity of RGB for each pixel. Equivalent of*n
option. Defaults to 0.coord_mode (
str
) – the Pixel CoordMode to use. Default is ‘Screen’scale_height (
Optional
[int
]) – Scale height in pixels. Equivalent of*hn
optionscale_width (
Optional
[int
]) – Scale width in pixels. Equivalent of*wn
optiontransparent (
Optional
[str
]) – Specific color in the image that will be ignored during the search. Pixels with the exact color given will match any color. Can be used with color names e.g. (Black, Purple, Yellow) found at https://https://www.autohotkey.com/docs/commands/Progress.htm#colors or hexadecimal values e.g. (0xFFFFAA, 05FA15, 632511). Equivalent of*TransN
optionicon (
Optional
[int
]) – Number of the icon group to use. Equivalent of*Icon
option
- Returns
coordinates of the upper-left pixel of where the image was found on the screen;
None
if the image was not found- Return type
Union[Tuple[int, int], None]
Note: when only scale_height or only scale_width are provided, aspect ratio is maintained by default.
-
pixel_get_color
(*args, **kwargs)[source]¶ AutoHotkey PixelGetColor reference
- Parameters
x – x coordinate
y – y coordinate
coord_mode –
alt –
slow –
rgb – returns
- Returns
the color as an RGB hexidecimal string;
-
pixel_search
(*args, **kwargs)[source]¶ AutoHotkey PixelSearch reference
- Parameters
color –
variation –
upper_bound –
lower_bound –
coord_mode –
fast –
rgb –
- Returns
the coordinates of the pixel; None if the pixel is not found
-