Screen

class ahk.screen.AsyncScreenMixin(executable_path='', directives=None, **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 option

  • scale_width – Scale width in pixels. Equivalent of *wn option

  • transparent – 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 option

  • icon – 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.

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

class ahk.screen.ScreenMixin(executable_path='', directives=None, **kwargs)[source]

AutoHotkey ImageSearch reference

Parameters
  • image_path (str) – path to the image file e.g. C:locationofcats.png

  • upper_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]]) – 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 (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 option

  • scale_width (Optional[int]) – Scale width in pixels. Equivalent of *wn option

  • transparent (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 option

  • icon (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;

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