Sign in to follow this  
Followers 0
T3k

HotKeySet("{LEFT MOUSE BUTTON}", "MyFunc")

10 posts in this topic

Is there a way to do the equivalent of hotkeyset() but use mouse buttons? e.g. when i right click a certain function is run?

Thanks!

T3k

Share this post


Link to post
Share on other sites



_IsPressed(1) ;left mouse

_IsPressed(2) ;right mouse

_IsPressed(4) ;middle mouse

_Ispressed(1) is not working for me wat am i doin wrong?

Code:

CODE
_IsPressed(1)

$var = MouseGetPos ()

MsgBox (0, $var[0], $var[1])

Share this post


Link to post
Share on other sites

ohh thx

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

The problem with that is I want to do something like this:

$key="{ENTER}"
$count = 0

HotKeySet($key, "function")

Func function()
    HotKeySet($key, "dummy")
    While _IsPressed('0D')  ;; OD is hex for {ENTER}
        $count += 1
    WEnd
    HotKeySet($key, "function")
EndFunc

Func dummy()
EndFunc

Sleep(10000)
MsgBox(0, 0, $count)

So that while you hold the key something happens, but the key itself doesnt get sent. Any thoughts?

Edited by T3k

Share this post


Link to post
Share on other sites

So that while you hold the key something happens, but the key itself doesnt get sent. Any thoughts?

You are on the right track, yet..

#include <misc.au3>
$key="{ENTER}"
$count = 0
HotKeySet($key, "function")

Sleep(10000)
MsgBox(0, 0, $count)

Func function()
    HotKeySet(@HotKeyPressed, "dummy") ;do it this way so multiple hotkeys can use this function
    While _IsPressed('0D')  ;; OD is hex for {ENTER} 
        Sleep(10) ;do something while key is held down..
    WEnd
    $count += 1 ;get exactly the number of times key was pressed
    HotKeySet(@HotKeyPressed, "function")
EndFunc

Func dummy()
EndFunc

Did this answer your question? Or am I missing what you are asking?


www.itoady.com

A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding

Share this post


Link to post
Share on other sites

You are on the right track, yet..

#include <misc.au3>
$key="{ENTER}"
$count = 0
HotKeySet($key, "function")

Sleep(10000)
MsgBox(0, 0, $count)

Func function()
    HotKeySet(@HotKeyPressed, "dummy") ;do it this way so multiple hotkeys can use this function
    While _IsPressed('0D')  ;; OD is hex for {ENTER} 
        Sleep(10) ;do something while key is held down..
    WEnd
    $count += 1 ;get exactly the number of times key was pressed
    HotKeySet(@HotKeyPressed, "function")
EndFunc

Func dummy()
EndFunc

Did this answer your question? Or am I missing what you are asking?

What I meant to ask was, how do you do that, but with a mouse button instead of enter, since you can't HotKeySet a mouse button to dummy?

Share this post


Link to post
Share on other sites

i think that was answered back in the first post...

#Include <Misc.au3>
$key="{ENTER}"
$count = 0

HotKeySet($key, "function")

Func function()
    While _IsPressed('0D')  ;; OD is hex for {ENTER}
        $count += 1
    WEnd
EndFunc

Sleep(10000)
MsgBox(0, "Count", $count)

Just incase none of the above worked heres this.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

i think that was answered back in the first post...

It wasnt. Maybe I'm not explaining well enough. I want it so that while the user holds down, say, the right mouse button the script does something, and stops when the button is released. But while it's doing that, the right click shouldn't go through to the OS (which is what HotKeySet($key, "dummy") does, but not for mouse buttons). Did that make sense?

Edited by T3k

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