Sign in to follow this  
Followers 0
seres

is this a bug

6 posts in this topic

i got interested in a topic it says:

HotKeySet("b","b_pressed")

Func b_pressed()

Send("b")

EndFunc

and it doesnt sends anything, so is that a bug or if not then how after u press b it sends b

Share this post


Link to post
Share on other sites



No it's not a bug.

It's kind of obvious what it does:

HotKeySet button B to a function that sends it, and it will cause a loop, over and over again.

To actually send the key that is hooked you'd have to 'unhook' it in the function.

Something like:

HotKeySet("b", "b_pressed")

While 1
Sleep(250)
WEnd

Func  b_pressed()
HotKeySet("b")
Send("b")
HotKeySet("b", "b_pressed")
EndFunc

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Or you could do something more elegant, like this:

HotKeySet("b", "_SendHotKey")

While 1
    Sleep(250)
WEnd

Func _SendHotKey()
    Local $svKey = @HotKeyPressed
    HotKeySet($svKey)
    
    TrayTip("", $svKey & " was pressed", 5)
    
    Send($svKey)
    HotKeySet($svKey, "_SendHotKey")
EndFunc

That way, you only need one function for all of your keys(if you intend to use it with several that is). :D

Edited by FreeFry

Share this post


Link to post
Share on other sites

Or you could do something more elegant, like this:

HotKeySet("b", "_SendHotKey")

While 1
    Sleep(250)
WEnd

Func _SendHotKey()
    Local $svKey = @HotKeyPressed
    HotKeySet($svKey)
    
    TrayTip("", $svKey & " was pressed", 5)
    
    Send($svKey)
    HotKeySet($svKey, "_SendHotKey")
EndFunc

That way, you only need one function for all of your keys(if you intend to use it with several that is). :D

thanks

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