Sign in to follow this  
Followers 0
Drew

Mouse Issue

5 posts in this topic

Alright. What I'm doing, is writing a program that will repeatedly click the left mouse button continuously until I press the same hotkey to turn it off.

In the script, I press ` to begin clicking. When I press ` , I want it to keep clicking until I press it again. Here's what I have so far, but I can turn off the clicking without hitting TAB to close the program. I've run out of ideas on this.

HotKeySet('{tab}', '_Exit')
HotKeySet('`', '_HotKey')

While 1
    $mousepos = MouseGetPos()
    wend

If @error Then
    $Error = 1
Else
    $Error = 0
EndIf

$mousepos = MouseGetPos()

Func _HotKey()
While 1
    MouseClick( "left")
WEnd
EndFunc


Func _Exit()
    MsgBox( 0, "Thanks!", "This will close the program.")
    Exit
EndFunc

Share this post


Link to post
Share on other sites



would it work somehow with a different loop?

Share this post


Link to post
Share on other sites

HotKeySet('{esc}', '_Exit')
HotKeySet('`', '_HotKey')

$clicking = False

While 1
    Sleep(200); IMPORTANT <- without this line your script would use 100% cpu usage
    
    If $clicking then MouseClick( "left")
wend


Func _HotKey()
    $clicking = Not $clicking
EndFunc


Func _Exit()
    MsgBox( 0, "Thanks!", "This will close the program.")
    Exit
EndFunc
Why do I always decide to help people when I should be doing homework? Ask if you have any questions about the code...


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

Very interesting way of going about it. I understand how it works, but I don't fully understand WHY it works that way. ( If you get what I mean. )

What exactly does this part mean:

$clicking = NOT $clicking

and how does it link $clicking to MouseClick()

Share this post


Link to post
Share on other sites

I just tried the script out , works great. Thanks a ton man.

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  
Followers 0