Jump to content
Sign in to follow this  
dazjehyy

Mousemove and Mouseclick

Recommended Posts

dazjehyy

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.

Share this post


Link to post
Share on other sites
veronesi

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.