[jawsscripts] Re: key pressed event

  • From: Doug Lee <doug.lee@xxxxxxxxxxxxxxxx>
  • To: jawsscripts@xxxxxxxxxxxxx
  • Date: Tue, 25 Sep 2007 07:25:39 -0400

Actually, if you are using the KeyPressedEvent, the key will go
through to the application if it doesn't have a script and will go
through to the application if there is a script only if the script
calls TypeCurrentScriptKey or otherwise emulates it.  In other words,
KeyPressedEvent is not able to block a key, but a script naturally
blocks keys.

It sounds though like what you want to do is already the default
behavior:  If you put code in the KeyPressedEvent that executes when a
certain key is pressed, it will execute regardless of whether a script
is attached to the key.  The decision of whether the app also gets the
key will be up to the script, not to the KeyPressedEvent.  If you have
a timing problem where your code runs before the script attached to a
key or before the application manages to process the key, try using
ScheduleFunction from the KeyPressedEvent to delay your code.  This of
course will require you to move your code into a separate function.

One more note:  It is generally a good idea to minimize how long the
KeyPressedEvent itself runs.  A slow KeyPressedEvent will give the
user the impression of a sluggish computer, because it will delay the
speaking of pressed keys.  My general plan for a KeyPressedEvent is

1.  Call the next KeyPressedEvent down the line.

2.  For any keys special to me, schedule the code to handle them.

3.  For anything else, do nothing else.

On Tue, Sep 25, 2007 at 07:04:23AM +0100, Martin Slack wrote:
Daniel,

 The details will be slightly different, depending on whether you do this 
within a completely separate script, or as part of the KeyPressedEvent 
function.  Basically, you will need code that looks like this:

If (condition) Then
   TypeCurrentScriptKey (); key goes through to app.
Else
 If (anotherCondition) Then
   ;execute your own script code
 EndIf
EndIf

 You will have to be able to specify both conditions yourself, depending on 
what you want done.  You might also want to deal with the script code 
first, depending on your priorities.  If neither condition is true, the key 
will not be passed to the application AND the script code will not be run.

 hth

Martin

----- Original Message ----- 
From: "Daniel Dalton" <daniel.dalton47@xxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Tuesday, September 25, 2007 1:34 AM
Subject: [jawsscripts] key pressed event


>Hi,
>
>How can I make a hot key first either run its script or if there is know 
>script then send it through to the application?
>I have some code here that I want executed once the key has either gone 
>through to the application or called its script.
>I am using the KeyPressedEvent function.
>
>Thanks,
>
>-- 
>Daniel Dalton

---snip---

__________?
View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

-- 
Doug Lee, Access Technology Programmer
SSB BART Group
mailto:doug.lee@xxxxxxxxxxxxxxxx  http://www.ssbbartgroup.com
"While they were saying among themselves it cannot be done,
it was done." --Helen Keller
__________ 
View the list's information and change your settings at 
http://www.freelists.org/list/jawsscripts

Other related posts: