Jump to content

Recommended Posts

Posted (edited)

So...I'm having trouble getting MouseClick or MouseMove to play nice.  If EITHER of the mouse options (or any combination of them) is uncommented, it ends up moving and/or clicking about 40px above the taskbar, instead of this location, which is where the button (currently) is.  What am I doing wrong?

 

 

CoordMode Pixel  ; Interprets the coordinates below as relative to the screen rather than the active window.
ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, C:\Users\thela\OneDrive\Desktop\Autoit\Send.png
if (ErrorLevel = 2)
    MsgBox Could not conduct the search.
else if (ErrorLevel = 1)
    MsgBox Icon could not be found on the screen.
else
    SetMouseDelay, -1
    MsgBox The icon was found at %FoundX%x%FoundY%.
    ;MouseClick
    ;MouseMove, %FoundX%, %FoundY%
    ;MouseClick, left, %FoundX%, %FoundY%

 

test.png

image.png

send.png

Edited by TheLandYacht
adding tags
Posted

Whoops!  I had tried to do it in AI & couldn't get THAT to play nice either, pretty much the same problem.  Same pictures, but the code looks more like this... and AI's search doesn't even find the correct coords.



 

#include <ImageSearch_UDF.au3>

Local $aResult = _ImageSearch("C:\Users\thela\OneDrive\Documents\Autoit\Send.png")

If @error Then  
    MsgBox(48, "Error", "Image not found on screen.")  
Else  
    Local $iCount = $aResult[0][0]  
    Local $iX = $aResult[1][0]  
    Local $iY = $aResult[1][1]  
    MsgBox(64, "Success", "Found " & $iCount & " image(s). First match is at: " & $iX & ", " & $iY)  
    ;MouseMove($iX, $iY, 20) ; Move mouse to the center of the found image  
EndIf

 

a.png

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...