seres Posted April 15, 2008 Share Posted April 15, 2008 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 Link to comment Share on other sites More sharing options...
FreeFry Posted April 15, 2008 Share Posted April 15, 2008 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 Link to comment Share on other sites More sharing options...
FreeFry Posted April 15, 2008 Share Posted April 15, 2008 (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). Edited April 15, 2008 by FreeFry Link to comment Share on other sites More sharing options...
smashly Posted April 15, 2008 Share Posted April 15, 2008 Hi, use the ASCII value for the Send().#include <misc.au3> HotKeySet("b","b_pressed") While (Not _IsPressed("1B")) Sleep(100) WEnd Func b_pressed() Send("{ASC 098}") EndFunc Cheers Link to comment Share on other sites More sharing options...
seres Posted April 15, 2008 Author Share Posted April 15, 2008 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). thanks Link to comment Share on other sites More sharing options...
seres Posted April 15, 2008 Author Share Posted April 15, 2008 Hi, use the ASCII value for the Send().#include <misc.au3> HotKeySet("b","b_pressed") While (Not _IsPressed("1B")) Sleep(100) WEnd Func b_pressed() Send("{ASC 098}") EndFunc Cheers thanks Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now