Jump to content

Mousemove and Mouseclick


Recommended Posts

Hi, I just begin AutoIT scripting and I'm very sad on it. Trying to make script what: Mouse Left click, move from mouse position to 20 coord down and Mouse Left click. I tryed this:

While 1
HotKeySet("{esc}", "ExitScript")
HotKeySet("1", "THarvest")
WEnd

Func ExitScript()
Exit
EndFunc

$posx = MouseGetPos()
$posy = MouseGetPos()


Func THarvest()
MouseGetPos()
MouseClick("left")
MouseMove($posx[0], $posy[1] 20, 10)
MouseClick("left")
EndFunc

Can anyone who know this language better to explain what is wrong on this and how to fix it ;P.

Thanks.

Link to comment
Share on other sites

Hi,

try this code:

;Main Loop
While 1
    HotKeySet("{ESC}", "ExitScript")
    HotKeySet("1", "THarvest")
WEnd



;Used functions
Func ExitScript() ;Exit Main Loop
    Exit
EndFunc    ;==>ExitScript

Func THarvest()
    $posX = MouseGetPos(0) ;Get x position of mouse
    $PosY = MouseGetPos(1) ;Get y position of mouse
    MouseClick("Left") ;click left
    MouseMove($PosX, $PosY + 20, 10) ;move mouse
    MouseClick("Left") ;click left
EndFunc    ;==>THarvest

Regards

Veronesi

Edited by veronesi
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...