Thanks Martin for the response. I'm afraid what I wanted was to know whenever WE silenced speech, because I have a macro running, which can take a long time to complete, and which generates speech as it runs, so if WE silenced speech, I wanted to stop my macro as well.
My trick at the moment is to use a combination of the onKeyDown() event to set a flag (similar to yours), and then onKeyProcessedDown() (because it follows shortly afterwards I believe), to reset it, so my macro is allowed to run again if the user causes it to do so. What I need is to be able to respond quickly to say a user pressing a series of quick up arrows as they move through a document. each one could cause my macro to start speaking a lot of text (in a loop with possibly some delay statements not just one blast from a speak command), and I need to be able to stop that loop when the user pressed a key, and yet allow it to run again as a result of that press. I'm sure this is going to take some tinkering. thanks. Chip -----Original Message----- From: martin webster [mailto:[email protected]] Sent: Monday, November 22, 2010 6:25 AM To: [email protected] Subject: RE: how to tell if the silence key was just pressed? Hi Chip, I don't think there's any way of being able to tell if window-eyes is actually speaking, but here's a little routine I came up with ages ago for something or other I was messing about with. I don't know if it's actually what you want, or how good it might fare in a complexed script but here goes, and bearing in mind you are a far better scripter than me smile.. begin Vbscript ' press "l" to start loop space to stop Dim KeyFlag Dim Counter : Counter = 0 Dim hk, sc Set hk = Keyboard.RegisterHotkey("l", "StartCount") Set sc = Keyboard.RegisterHotkey("space", "StopCount") Sub StartCount() KeyFlag = False If Not KeyFlag And Counter = 0 Then Counter = 0 Count End If End Sub Sub StopCount() KeyFlag = True Counter = 0 End Sub Sub Count() Do While Not Counter = 10 And Not KeyFlag Counter = Counter + 1 Speak Counter Sleep 1000 Loop Counter = 0 KeyFlag = False End Sub Warm regards. Martin Webster. --- On Sun, 11/21/10, Chip Orange <[email protected]> wrote: > From: Chip Orange <[email protected]> > Subject: RE: how to tell if the silence key was just pressed? > To: [email protected] > Date: Sunday, November 21, 2010, 5:36 PM hi again, > > to try and answer my own question: I've settled for now on trying to > use the keyboard onKeyProcessedDown event; figuring any time a key is > pressed is probably a good bet speech is interrupted, and almost the > only way speech is interrupted. I haven't programmed it yet to see > how well it works, but for anyone else who might need this, I thought > I'd throw out my thoughts. > > Chip > > > -----Original Message----- > From: Chip Orange [mailto:[email protected]] > > Sent: Saturday, November 20, 2010 10:37 PM > To: [email protected] > Subject: how to tell if the silence key was just pressed? > > Hi all, > > I need to stop what I'm doing in my script, if the user presses the > silence key, or even better, if he does anything which interrupts > speech at all. > > does anyone have any ideas on how I may detect either of these two > events occurring? > > thanks. > > Chip > >
