jicheon
jicheon

Reputation: 9

Comparing image searching with AHK or pyAutoGUI?

I am considering UI automation.

image searching of pyAutoGUI (Python) seems a little slow comparing with Autohotkey.

I guess pyautoGUI try to find image from full screen but autohotkey try to find image from specific area because I use "winactive" option.

Can anyone give a advice?

Upvotes: 0

Views: 1663

Answers (1)

user15189441
user15189441

Reputation:

(Assuming you are using Windows)

AutoHotkey/AHK is much better option here, as it does not rely on dependency like python does and performs better, even with minimal resources.

specific area because I use "winactive" option

It doesn't have to, you can search whole screen..[ImageSearch AHK Docs]

example.,

IMG_PATH := "‪C:\Users\YOURNAME\Desktop\gLogo.bmp"
CoordMode Pixel  ; Interprets the coordinates below as relative to the screen rather than the active window.
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, *50 %IMG_PATH%
if (ErrorLevel = 2)
    MsgBox Could not conduct the search.
else if (ErrorLevel = 1)
    MsgBox Icon could not be found on the screen.
else
    MouseMove, %FoundX%,%FoundY%

It doesn't have to be a .bmp you can use any image with least-compression.

After all compared to pyautogui, AHK is much simpler to write.

Upvotes: 1

Related Questions