AutoHotKey - clik on image

2019-09-20 13:45发布

问题:

I'd like to change send {Browser_Back} to a mouse click in a specific image / or a specific point (pixel).

SendMode , Input
SetMouseDelay , -1
SetBatchLines , -1
Loop
{
    ImageSearch ,,, 0 , 0 , A_ScreenWidth , A_ScreenHeight , mor.png
    bT := ErrorLevel ? bT : 1
    ImageSearch ,,, 0 , 0 , A_ScreenWidth , A_ScreenHeight , NewPic2.png
    bT := ErrorLevel ? bT : 1
    ImageSearch ,,, 0 , 0 , A_ScreenWidth , A_ScreenHeight , NewPic3.png
    bT := ErrorLevel ? bT : 1
    If bT
    {
        bT := 0
        Send , {Browser_Back}
        Sleep , 100
}   }
Return
f1::ExitApp

回答1:

No problem, just replace the Send , {Browser_back} line with Click , 500 , 500. Replace the 500s with the x- and y-coordinates of where you want to click.



回答2:

Random clicking in the given area

x, from pixel to pixel, y, from pixel to pixel

example

Random, x, 1130,1300
Random, y, 580, 680
Click %x% %y%


标签: autohotkey