Hello,
I currently have a problem that deals with moving the mouse to a given location + or - a certain distance.
$search1 =_WaitForImageSearch("envelope.bmp", 10, 1, $x, $y, 20)
$search2 =_WaitForImageSearch("envelope2.bmp", 10, 1, $x, $y, 20)
If $search1 = 1 Then
Sleep(100)
MouseMove($x, $y, 10)
sleep(99)
MouseClick("left")
Sleep(99)
ElseIf $search2 = 1 Then
Sleep(100)
MouseMove($x, $y2, 10)
sleep(99)
MouseClick("left")
Sleep(100)
Else
Sleep(150)
MouseMove($x2, $y, 10)
Sleep(150)
MouseClick("left")
Sleep(150)
EndIf
The problem about this is that i defined $x2 = $x - 175 and $y2 = $y + 35
I got these numbers ( 175 and 35) with the autoit helper and just subtracted point where it is to the point its supposed to move but it doesnt work.
is there any proper way to find the distance between 2 points in pixels?
Imgsearch doesnt always work for this picture so i want it to have a backup
edit: could it be that the definition of $x and $y from the previous image search arent there anymore and thats why it moves my mouse to strange places?
is there a way to preserve the $x $y from the previous img search untill the next succesful one?