so im trying to make a macro that will use image search to find and click something then move to another area and click a designated coordinate.
then accept the dialog by clicking the accept button (also do-able thorough image search i suppose)
its just clicking one of 40 icons which are all the same, then dragging and dropping it to a window and pressing accept. but there is no need to hold down the mouse button to drag.
im new to image search though and having problems using the syntax properly.
this all happens withing a game type application also.
help with macro using image search
Re: help with macro using image search
You seem to have missed adding in your script that you need help with.
Imagesearch is sometimes a challenge to get working properly and even more so in games. Here is a starting point where you can fiddle with variables till you get what you are looking for as well as see what each variable is used for. You may have to compile and run your program in administrator mode, it all depends on the game.
Imagesearch is sometimes a challenge to get working properly and even more so in games. Here is a starting point where you can fiddle with variables till you get what you are looking for as well as see what each variable is used for. You may have to compile and run your program in administrator mode, it all depends on the game.
Code: Select all
f4::
x1 := 0
y1 := 0
x2 := A_ScreenWidth
y2 := A_ScreenHeight
variation := 50
filename = C:\scripting\diablo2\rune.png
ImageSearch, FoundX, FoundY, x1, y1, x2, y2, *%variation% %filename%
if ErrorLevel = 2
{
MsgBox Could not conduct the search. Your file called %filename% does not exist
return
}
else if ErrorLevel = 1
{
MsgBox Your image %filename% could not be found on the screen.
return
}
else
{
mousemove, %foundx%, %foundy%
; clipboard = %foundx%`, %foundy% ;un-comment this line to get the co-ordinates to your clipboard
MsgBox The image %filename% was found at %FoundX%x%FoundY%.
Return
}
Re: help with macro using image search
thank you! i pretty much figured it would be as easy as image search finding the image. clicking it. then moving to the right coordinate i define and clicking again. just need it to do that on loop. i shall experiment.grant wrote:You seem to have missed adding in your script that you need help with.
Imagesearch is sometimes a challenge to get working properly and even more so in games. Here is a starting point where you can fiddle with variables till you get what you are looking for as well as see what each variable is used for. You may have to compile and run your program in administrator mode, it all depends on the game.
Code: Select all
f4:: x1 := 0 y1 := 0 x2 := A_ScreenWidth y2 := A_ScreenHeight variation := 50 filename = C:\scripting\diablo2\rune.png ImageSearch, FoundX, FoundY, x1, y1, x2, y2, *%variation% %filename% if ErrorLevel = 2 { MsgBox Could not conduct the search. Your file called %filename% does not exist return } else if ErrorLevel = 1 { MsgBox Your image %filename% could not be found on the screen. return } else { mousemove, %foundx%, %foundy% ; clipboard = %foundx%`, %foundy% ;un-comment this line to get the co-ordinates to your clipboard MsgBox The image %filename% was found at %FoundX%x%FoundY%. Return }
Re: help with macro using image search
did you get this to work m8?
Who is online
Users browsing this forum: No registered users and 104 guests