When I click on the wheel of my mouse, the click is also done on all the filled windows.
This function works well.
I wanted to add a function that allows to detect an image on the filled windows, if the image is found, it clicks on it.
But since I added the SearchImageOnAllWindows function, the script gives me an error :
Code: Select all
gameWindows := ["Youk - Dofus 2.51.4.0", "Olokun - Dofus 2.51.4.0"]
searchImage := "C:\Users\Me\Desktop\AHK\pret.png"
searchInterval := 2000 ; temps en millisecondes entre chaque recherche
SetTimer, SearchImageOnAllWindows, %searchInterval%
return
SearchImageOnAllWindows:
{
CoordMode, Mouse, Screen
for index, gameWindowTitle in gameWindows {
WinGet, gameWindowID, ID, %gameWindowTitle%
WinActivate, ahk_id %gameWindowID%
ImageSearch, searchX, searchY, 0, 0, A_ScreenWidth, A_ScreenHeight, %searchImage%
if ErrorLevel = 0 {
ControlClick,, %gameWindowTitle%, , LEFT,, NA x%searchX% y%searchY%
}
}
}
MButton:: ; clique molette de la souris
{
CoordMode, Mouse, Screen
for index, gameWindowTitle in gameWindows {
WinGet, gameWindowID, ID, %gameWindowTitle%
ControlClick,, %gameWindowTitle%, , LEFT,, NA x%A_CaretX% y%A_CaretY%
}
}