Clouds Posted May 4, 2007 Posted May 4, 2007 Hey all,I've just created a script that monitors keystrokes, and when a certain sequence comes by, it starts a program.(No, I'm not trying to get help building a key-logger )The specific sequence is entered using a barcode scanner, and with this script there is no need to start an application before a barcode is scanned.Just scan a barcode, and the application will start if not yet active.The script works OK already, but one thing is still bugging me.99% of the script is from Larry's MouseHook example script (thanks Larry!), but it doesn't seem to act on key up events properly.In fact, if I take the example script, delete this lineGUIRegisterMsg($WM_KEYUP,"myKeyfunc")every keypress still shows 2 messages in the tooltip...I would expect only 1 message (for keydown only).It looks like the KEYDOWN message is firing on both keydown and keyup events?Or am I just wrong? For now, I just made a counter that ignores every 2nd key event to get it working, but I prefer the better way where KEYDOWN isn't reacting to a key being released...Anyone have a clue what can be done to solve this?--Clouds®
Clouds Posted May 4, 2007 Author Posted May 4, 2007 Toady, Thanks for the reaction, but I'm not sure how this helps? My script already works, I know which keys were pressed. Only thing is that WM_KEYUP in the MouseHook script doesn't do what I expect it do to.... -- Clouds®
Toady Posted May 4, 2007 Posted May 4, 2007 Toady,Thanks for the reaction, but I'm not sure how this helps?My script already works, I know which keys were pressed.Only thing is that WM_KEYUP in the MouseHook script doesn't do what I expect it do to....--Clouds®I posted this becuase it will only record the key after it has been released. Therefor solving your 2 event firing problem.More than helpful IMO. Your just making it harder than it should be... www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding
Clouds Posted May 7, 2007 Author Posted May 7, 2007 (edited) @Toady:Ok, thanks, I just didn't get what you meant (not a wonder Friday past 5pm ).Have tried your solution but it's not fast enough to detect all keystrokes, not even when reducing the sleep time in the main loop.Thanks anyway for the suggestion!@Larry:Thanks a lot! Works perfectly now....--Clouds® Edited May 7, 2007 by Clouds
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