DragonBall Posted November 30, 2011 Share Posted November 30, 2011 I use the following script, which one part of it is to save the file when some keys are typed. The (whole ) script runs 700 times per minute. If I drop the For loop, it runs 760 times per minute. I searched on Google and found switch is faster. I am wondering if it is possible to do something like:$keytyped = _GetKey()Switch $keytyped Case .....( in the range i want) Save FileEndSwitchYou may think I am asking for a keylogger, but No! I have known how to do this with a lot of _ispressed and a lot of MsgBox , which can be found by Google. It is easy to find one, so if I want to use keylogger, I don't have to ask it here. If you have idea to speed up the part in my script and you don't want to post it on this forum, please PM me. While 1 ...... For $i = 48 to 90 If _isPressed(Hex($i), $dll) OR _isPressed("8", $dll) OR _isPressed("20", $dll) OR _isPressed( Hex( _Min($i+48, 111) ), $dll) OR _isPressed( Hex( _Min($i+138 , 190) ), $dll) Then Save the file ExitLoop ; Once a character typed is detected, don't check other characters ;;; One can delete this line and get fast render. But why??? EndIf Next ...... WEnd Link to comment Share on other sites More sharing options...
Mat Posted November 30, 2011 Share Posted November 30, 2011 (edited) You could try GetKeyboardState... That way there is only one dll call. Looks like there is an autoit wrapper Edited November 30, 2011 by Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
DragonBall Posted November 30, 2011 Author Share Posted November 30, 2011 After remove the functions I don't need from Yashied HotKey UDF, I get the following script, whichwhen you press a key, it will give you the decimal number $Keycode of this key. So one can use this if:You want to check if some (many) keys are pressed. If yes, then do the same jobs.Of course one can use _ispressed many times, but using this script, one can use Switch $Keycode, which turns out be be more fast than many if and don't check _ispressed many times!I don't know how this script works, I just remove the parts I don't need from Yashied Hotkey UDF, but it works very well!! 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