Toady Posted April 30, 2007 Posted April 30, 2007 One of my scripts sometimes will send a key press down. This state will stay like this even when script exits. Is there are way to "reset" the keyboards status without having to send the key press up? Any methods in user32.dll that does this? I have searched around and can't find anything about resetting a keyboards key status. I do not want to have to loop through all the keys and if a key is pressed then send the key up. Is this possible? www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding
PsaltyDS Posted April 30, 2007 Posted April 30, 2007 (edited) Sure enough, all it takes to demo is a one line script: Send("{SHIFTDOWN}") You could use an AutoItOnExit function to clear whatever your script is leaving behind. I don't know if you really want a "keyboard reset", if such exists, because you would lose things like Num Lock setting, which could be annoying to the user. Edited April 30, 2007 by PsaltyDS Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Toady Posted April 30, 2007 Author Posted April 30, 2007 Sure enough, all it takes to demo is a one line script: Send("{SHIFTDOWN}") You could use an AutoItOnExit function to clear whatever your script is leaving behind. I don't know if you really want a "keyboard reset", if such exists, because you would lose things like Num Lock setting, which could be annoying to the user. Ya good point. As of right now Im just looping through all the possible keys and if a key is pressed it will send the key up for that key. I have this in the AutoItonExit, as well as some other places that will need it. Im trying to keep away from having to loop though all keys becuase my script requires good performance. Thank you for you input www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding
SkinnyWhiteGuy Posted April 30, 2007 Posted April 30, 2007 Well, just from reading the post, wouldn't it be almost as easy to, when you send the Down Key within your script, record it to an array, and when you do your checking, instead of checking all keys, just check the keys in that array list, clear it, and keep going? That would help lessen the size your loop had to go through.
Toady Posted April 30, 2007 Author Posted April 30, 2007 Well, just from reading the post, wouldn't it be almost as easy to, when you send the Down Key within your script, record it to an array, and when you do your checking, instead of checking all keys, just check the keys in that array list, clear it, and keep going? That would help lessen the size your loop had to go through.I had that idea but I didn't want to any comparing in real-time during one of my function calls, performance is crucial. I have found a solution to this though. Thanks for all of your input www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding
Shevilie Posted April 30, 2007 Posted April 30, 2007 I have found a solution to this though. Thanks for all of your inputPlease enlight us.. so the next to ask the question would be able to find the answer here Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
Toady Posted April 30, 2007 Author Posted April 30, 2007 My script requires that user to create a macro of keystrokes, sometimes the user can forget to add a key up after a key down. This would make the key never get released until he/she has pressed that key again manually. So instead I made a function to check the entire list of keystrokes the user has entered and if a key hold does not have a key up then a message is displayed warning them about it and how to fix it. www.itoady.com A* (A-star) Searching Algorithm - A.I. Artificial Intelligence bot path finding
Shevilie Posted April 30, 2007 Posted April 30, 2007 Just have a array keeps hold of all keys that have been down and remove them on the up... so if theres any keys left in the array its because it hasn't been raised Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
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