ImageSearch + MouseMove

07/25/2018 15:38 naZguL86#1
Hi,

Gibt es eine möglichkeit das wenn ein Bild gefunden wurde per ImageSearch das er dann mit der Maus per MouseMove z.b über das gefundene Bild moved?
Sprich die Maus soll immer ein stück über dem gefundenem Bild Moven.

Danke euch schonmal.

Hier ein beispiel Bild damit ihr besser versteht was ich damit meine:

[Only registered and activated users can see links. Click Here To Register...]



PHP Code:
#include <ImageSearch2015.au3>
#include <AutoItConstants.au3>

HotKeySet("{NUMPAD7}","Start")
HotKeySet("{NUMPAD8}","Pause")
HotKeySet("{NUMPAD9}","Ende")
Global 
$funcs false

Func Start
()
$funcs True
EndFunc

Func Pause
()
$funcs False
while $funcs False
sleeP
(500)
WEnd
EndFunc

Func Ende
()
Exit
EndFunc

$X 
0
$Y 
0

while 1
if $funcs True then
  $target 
_ImageSearch('tt.bmp'1$X$Y0)
   If 
$target 1 Then
      MouseMove
($X$Y,1)
   EndIf
EndIf
WEnd 
07/25/2018 20:33 Moneypulation#2
Du bist nicht dazu gezwungen MouseMove(x,y) zu machen. Finde einfach den heraus was der Offset von deinem gewünschten Punkt zum Bild ist und mache dann sowas wie MouseMove(x+50, y-50) wenn dein Offset beispielsweise (50,-50) ist

Edit: Falls du es noch nicht wusstest liefert 1 als 2. Parameter in ImageSearch die Koordinaten links oben vom gefunden Bild. Von dort musst du dir also den Offset errechnen
07/25/2018 22:40 naZguL86#3
Danke für die antwort
09/10/2018 16:32 VitorCornelius#4
I bet you do not need #include <AutoItConstants.au3> line at all, at least for my imagesearch udf not needed.

I recomend you to do not put the imagesearch itself alone in a while loop with mousemove, cause it will keep move your mouse in that position all day long, and you have to close your script if you want to get back the control on it.

If you wana speed up the process, like you are looking for the image non stop if it is apire on your screen multiple times while you are running your script, then use _ImageSearchArea function. You can set a location on your screen where to search for that image. It will help for your CPU.

ImageSearch function second parameter:
Set where the returned x,y location of the image is.
1 for centre of image, 0 for top left of image

So if u wana click on the image use 1.
For the last parameter, i recomended to use greater value then 0, cause it is the tolerance (pixel color difference). 0 mean exactly same image.

for Pause function (standerd version):
Func _PAUSE()
$paused = Not $paused
While $paused
Sleep(100)
ToolTip('Script is "Paused"', 0, 0)
WEnd
ToolTip("", 0, 0)
EndFunc

Edit:
P.S.:
Sry for my english :)
My german knowleadge is almost 0. :/