Hi David, for #1, you have to use onKeyDown in combination with onKeyUp to block the kystroke from getting to the application or to window eyes. this means, you probably just tell onKeyDown to block the keystroke, but you probably don't act on it in your script. in onKeyUp, you tell it to block the keystroke, and then you trigger your script to act on it. As for #2, the only thing I see if a method of the keyboard object named waitFor AllKeysUp. if you're trying to write something where a short wait isn't a problem, then this is what you want. sometimes though, scripts can't tollerate a wait at all because they need to respond immediately (such as the return values of onKeyDown and onKeyUp); in that case, you'll need to use the "queue" command to run a subroutine separately, and have that subroutine call waitForAllKeysUp before doing what you need done. you'll see a warning to this effect in the help docs for onKeyDown. hth, Chip
_____ From: David [mailto:[email protected]] Sent: Friday, April 23, 2010 8:26 PM To: Scripting List WE Subject: Re: OnKeyUp - help needed OK, I now have got that far, that the script actually does 'see' which keys I have pressed, and is able to combine them, the way I want. I think what I missed out on, was the ConnectEvent instruction. But I am now left with two questions, hoping for someone to point me in the right direction. 1. If my script hooks on to the S, D, and F keys, on my keyboard. Is it possible for me to 'block' these keys from being 'seen' by the application? Right now, the script sees the keystrokes, and does its job with them, but my problem is, the keystrokes get passed through to the application, leaving me no chance of modify them as I want. Which instructions could I use, so as to make sure, I get the chance of modifying the keystrokes, before they are passed to the application? 2. Is there any Event I can hook on to, that will tell when NO keys are down any longer? Kind of an 'AllKeyUp' event. What I am after, is this: My script will be performing one action, if the F key is pressed, another if the D is pressed; and still another if the F and D was pressed simultaneously. Allright, I hooked on to the OnKeyUp event, and it sees whether I pressed the one, the other, or both keys. But I can't seem to get it to move anything further. I would need a chance to know, that now all keys have been released, and the process can move on. To illustrate what I am trying to say, here is a small cut of the script: Dim B1, B2 Dim H1, H2 Dim S Function K1(PK, PM) S = S & "1" Speak "1" End Function Function K2(PK, PM) S = S & "2" Speak "2" end Function Sub ReadKey() Set B1 = Keyboard.Keys(VK_F) H1 = ConnectEvent( B1, "OnKeyUp", "K1" ) Set B2 = Keyboard.Keys(VK_D) H2 = ConnectEvent( B2, "OnKeyUp", "K2" ) End Sub S = "" ReadKey() Speak "You pressed the keys: " & S When running the script, the Speak instructions found in the two functions, do speak. But the final 'resulting' speak instruction (that is, the last line of my code above), won't speak the combined result. Any Idea why? My script keeps running, till I hit a 'turn off' hotkey. I need to have access to the resulting S value, everytime all keys have been released. And, that is where I am stuck. Any help and kicks will be greatly appriciated! Thanks alot for all assistance. ----- Original Message ----- From: Aaron Smith To: [email protected] Sent: Friday, April 23, 2010 11:05 PM Subject: Re: OnKeyUp - help needed You'll get an event for each key released, not all of them at once. You would then have to keep track yourself of whether or not they were released in some sort of order that you care about. Your bewilderment comes from needing more knowledge about how events work. I could consult your local VBScript resource, and brush up on those. Once you have that knowledge, Window-Eyes events will fall into place. Aaron On 4/23/2010 4:56 PM, David wrote: HM, see if I get you correct here. YOu mean, I would need something like: Sub Results( pressedkeys ) Speak "You pressed the following keys: " If PressedKeys = VK_F Then Speak "F, " If PressedKeys = VK_D Then Speak "D, " IF PressedKeys = VK_S Then Speak "S, " End Sub Am I getting any closer? And if so, how do I pass the Event to the sub? Sorry, but I am quite bewildered here. ----- Original Message ----- From: Aaron Smith To: [email protected] Sent: Friday, April 23, 2010 10:49 PM Subject: Re: OnKeyUp - help needed OnKeyUp is an event. Events can be monitored so that you can perform some action when the event you're interested in happens. In other words, you need to write a routine that accepts the parameters passed by the event, and act accordingly when those parameters mean something you're interested in (in this case, they keys that are released). Aaron On 4/23/2010 4:19 PM, David wrote: I need to check if the S D and F keys has been pressed, and if they are pressed in any simultaneous combination. I did read the chapter on OnKeyUp, and also the OnKeyProcessedUp. But it seems my skills fell short here. If I try something like the following, I get the message that Object does not support and so forth. Result = Keyboard.OnKeyUp( VK_f, 0 ) Am I totally lost, when trying to use the OnKeyUp? or, what is it I am doing wrong. And, any input as to how for me to check more than one key. Is it possible, in any way, to do kind of OnKeyUp( VK_F & VK_D & VK_S, 0 ) Thanks for any feedback! ---------------------------------------------------------------------------- ---- I am using the Free version of SPAMfighter. We are a community of 7 million users fighting spam. SPAMfighter has removed 1548 of my spam emails to date. The Professional version does not have this message. -- Aaron Smith Product Support Specialist * Web Development GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825 260-489-3671 * gwmicro.com To insure that you receive proper support, please include all past correspondence (where applicable), and any relevant information pertinent to your situation when submitting a problem report to the GW Micro Technical Support Team. -- Aaron Smith Product Support Specialist * Web Development GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825 260-489-3671 * gwmicro.com To insure that you receive proper support, please include all past correspondence (where applicable), and any relevant information pertinent to your situation when submitting a problem report to the GW Micro Technical Support Team. _____ I am using the Free version of SPAMfighter <http://www.spamfighter.com/len> . We are a community of 7 million users fighting spam. SPAMfighter has removed 1548 of my spam emails to date. The Professional version does not have this message.
