PixelSearch + PostMessage Click
Posted: 24 Jul 2017, 13:00
Is it possible to use PixelSearch and PostMessage to click on something in Chrome? I cannot seem to figure out why this isn't working.
Code: Select all
;https://autohotkey.com/board/topic/60285-clicking-on-non-active-window-using-postmessagesendmessage/
PixelSearch, Px, Py, 1, 1, 1920, 1080, 0x3296FF, 0, Fast
ControlGet, chwnd, Hwnd,, Edit1, Personal inbox - Google Chrome
PostClick(%Px%, %Py%, chwnd)
return
PostClick(x, y, hwnd)
{
lParam := x & 0xFFFF | (y & 0xFFFF) << 16
PostMessage, 0x201, 1, %lParam%,, ahk_id %hwnd% ;WM_LBUTTONDOWN
PostMessage, 0x202, 0, %lParam%,, ahk_id %hwnd% ;WM_LBUTTONUP
}