I know that there is ImageSearch, but I don't know how to write the script. For example, when the image appear on screen it detect it and click key. Is there a way to do it and how?
Sorry for the trouble, im new in this
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
Code: Select all
SetBatchLines -1
Loop
{
image:
ImageSearch, posX, posY, 0, 0, A_ScreenWidth, A_ScreenHeight, 1.png
If (ErrorLevel=0)
{
SendEvent, {Space Down}
Sleep, 10
SendEvent, {Space Up}
}
Else
{
goto, image
}
}
Code: Select all
#SingleInstance,Force
SetWorkingDir,%A_ScriptDir%
CoordMode,Mouse,screen
CoordMode,Pixel,Screen
Gui, Font, clime
Gui, Add, Text, x90 y10, Testing
Gui, Add, Button, x90 y30 w70 h30 gstart, Start
Gui, Add, Button, x90 y70 w70 h30 gstop, Stop
Gui, Add, Button, x90 y110 w70 h30 gexit, Exit
Gui, +AlwaysOnTop
Gui, Color, Black
Gui, Show, w250 h160,Test
return
GuiClose:
ExitApp
return
start:
ImageSearch, PosX1, PosY1, 0, 0, A_ScreenWidth, A_ScreenHeight, image1.png
if (ErrorLevel=0)
{
msgbox, found1
}
Else if (ErrorLevel=1) or (ErrorLevel=2)
{
ImageSearch, PosX2, PosY2, 0, 0, A_ScreenWidth, A_ScreenHeight, image2.png
if (ErrorLevel=0)
{
msgbox, found2
}
Else if (ErrorLevel=1) or (ErrorLevel=2)
{
msgbox, not found
}
}
return
stop:
return
exit:
ExitApp
return
^x::ExitApp
Users browsing this forum: No registered users and 112 guests