Jump to content

Mouseclick Problem/help


Recommended Posts

Hello to all...

I have a little problem here and i need your help... I ve made an autoclicking script with the support of HotKeys...

HotKeySet ("{INS}", "autoclick")
Func autoclick()
    Opt("MouseClickDelay", 1000)
    $pos = MouseGetPos()    
    MouseClick ("left", $pos[0], $pos[1], 99999)
EndFunc

Well my problem is when i press INSERT the script starts... but i don't know how to make a function to stop it... I can't reduce the clicks cause i want them unlimited :think: Also i don't want to use Exit...

As i can imagine i need a code here to stop all the mouse activities when i press the hotkey i ll set for it... Right? Why i can't find such code then?? :(

Link to comment
Share on other sites

  • Moderators

Global $NoPause
HotKeySet ("{INS}", "autoclick")
HotKeySet('{PAUSE}', 'StopClick')

While 1
    Sleep(5000)
WEnd

Func autoclick()
    Opt("MouseClickDelay", 1000)
    $NoPause = 1
    Local $pos = MouseGetPos()  
    While $NoPause = 1
        MouseClick ("left", $pos[0], $pos[1], 1)
        Sleep(10)
    WEnd
EndFunc

Func StopClick()
    $NoPause = 0
EndFunc
Uses the Pause Key to stop the clicks. With the loop will click until you pause it.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Well that's what i was looking for thnx a lot... but there is still a little prob.. i just tried what u told me...

the script works and stops fine but i can't move my mouse while clicking cause the script center the mouse at the coordinates it started to click Oo

Can we fix that cause i need to move wherever i want the mouse while the script is clicking???

Ok wrong :think: i found it out... i just have to move the MouseGetPos inside the While :)

Anyway thnx a lot guys i just finished with that script :(

Edited by Erwtas
Link to comment
Share on other sites

  • Moderators

Well, ask yourself this, what gives the mouse click the position to click... then look at the mouse click inside the loop, what is missing if you want to move the mouse? The thing that gives it the position right?

Global $NoPause
HotKeySet ("{INS}", "autoclick")
HotKeySet('{PAUSE}', 'StopClick')

While 1
    Sleep(5000)
WEnd

Func autoclick()
    Opt("MouseClickDelay", 1000)
    $NoPause = 1
    While $NoPause = 1
        Local $pos = MouseGetPos()  
        MouseClick ("left", $pos[0], $pos[1], 1)
        Sleep(10)
    WEnd
EndFunc

Func StopClick()
    $NoPause = 0
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...