[jawsscripts] Re: Modifying keypressed event

  • From: "Bryan Garaventa" <bgaraventa11@xxxxxxxxxxxxxx>
  • To: <jawsscripts@xxxxxxxxxxxxx>
  • Date: Fri, 12 Jun 2009 17:14:18 -0700

The way I've done this in the past, is to set up one script called 
KeyHandler() or something like, then manually open up the jkm key map file 
and assign all of the hotkeys that I wanted to analyze and/or capture. Like 
so

a=KeyHandler
b=KeyHandler
Space=KeyHandler

etc. Then check each key within the script, and return or let through as 
desired.

Good luck,
Bryan

----- Original Message ----- 
From: "Donald Marang" <donald.marang@xxxxxxxxx>
To: <jawsscripts@xxxxxxxxxxxxx>
Sent: Friday, June 12, 2009 3:38 PM
Subject: [jawsscripts] Re: Modifying keypressed event


>I can see the logic in that.  I guess I should rewrite all of my
> KeyPressedEvent functions into separate scripts for each key checked.  But 
> I
> still have two questions:
> 1.  How do you assign scripts to keys like; Enter, Spacebar, Delete and
> Backspace?
> 2.  Is it possible to prevent the key from getting to the application 
> short
> of creating a hook for all keys?  What event/internal function passes
> keystrokes to the application?
>
> Don Marang
>
>
> ----- Original Message ----- 
> From: "Dennis Brown" <DennisTBrown@xxxxxxxxxxx>
> To: <jawsscripts@xxxxxxxxxxxxx>
> Sent: Friday, June 12, 2009 4:57 PM
> Subject: [jawsscripts] Re: Modifying keypressed event
>
>
>> Keep in mind that the KeyPressedEvent gets processed with every 
>> keystroke,
>> so your condition checks will get launched everytime a key is pressed.
>> That
>> calculates into a lot of useless overhead, and the key will get passed
>> through anyway.
>> Use a script to announce your text, then assign your key to that script.
>> This way, Jaws traps your keystroke, and KeyPressedEvent isn't tasked to
>> check the condition with the other hundred or so keystrokes that don't
>> apply!
>> Hope this helps!
>>
>> Thanks,
>> Dennis Brown
>>
>> ----- Original Message ----- 
>> From: "Brian Hartgen" <jaws@xxxxxxxxxxx>
>> To: <jawsscripts@xxxxxxxxxxxxx>
>> Sent: Friday, June 12, 2009 12:42 PM
>> Subject: [jawsscripts] Re: Modifying keypressed event
>>
>>
>>> Thanks Don
>>>
>>> That seems logical, I'll try it.
>>> Thank you.
>>>
>>>
>>> -----Original Message-----
>>> From: jawsscripts-bounce@xxxxxxxxxxxxx
>>> [mailto:jawsscripts-bounce@xxxxxxxxxxxxx] On Behalf Of Donald Marang
>>> Sent: Friday, 12 June 2009 5:36 PM
>>> To: jawsscripts@xxxxxxxxxxxxx
>>> Subject: [jawsscripts] Re: Modifying keypressed event
>>>
>>> Hi Brian,
>>>
>>> I will give you an example of what I do.  I will set conditions to watch
>>> for
>>>
>>> certain keys from certain windows to perform my desired action.  If I do
>>> not
>>>
>>> want the key passed to the application, I use a Return statement after
>>> the
>>> action to exit my KeyPressedEvent function before it has a chance to 
>>> call
>>> the default KeyPressedEvent function.  As in most system Event 
>>> functions,
>>> the default event function you are overriding is normally called toward
>>> the
>>> end of your event function.  The default KeyPressedEvent function passes
>>> the
>>>
>>> key to the application.
>>>
>>> Void Function KeyPressedEvent (Int iKeyCode, String sKeyMapName, Int
>>> iBraille, Int iAttachedToScript)
>>> If GetCurrentControlID () ==WCID_SEARCH Then
>>> If iKeyCode == key_ENTER  Then
>>>  PerformScript GoToResults()
>>>  Return
>>> EndIf
>>>
>>> KeyPressedEvent (iKeyCode, sKeyMapName, iBraille, iAttachedToScript)
>>>
>>> If iKeyCode == key_delete
>>> || iKeyCode == key_Backspace Then
>>>  ; SayMessage (OT_DEBUG, "In KeyPressedEvent: deleting")
>>>  ; SayMessage (OT_DEBUG, "KeyPressed, char pressed = " + sKeyMapName)
>>>  UpdateResults ()
>>>  SayResults ()
>>> EndIf
>>> ElIf GetControlID (GetFirstChild (GetParent (GetCurrentWindow ())))
>>> ==WCID_VOICE_MAIL_PLAYER_STATUS Then
>>> If iKeyCode == key_SPACEBAR Then
>>>  PerformScript PlayVoiceMail()
>>> EndIf
>>> Else ; not in search edit box or Voice Mail Player
>>> KeyPressedEvent (iKeyCode, sKeyMapName, iBraille, iAttachedToScript)
>>> EndIf
>>>
>>> EndFunction
>>>
>>> Don Marang
>>>
>>>
>>> ----- Original Message ----- 
>>> From: "Brian Hartgen" <brian@xxxxxxxxxxx>
>>> To: <jawsscripts@xxxxxxxxxxxxx>
>>> Sent: Friday, June 12, 2009 8:33 AM
>>> Subject: [jawsscripts] Modifying keypressed event
>>>
>>>
>>>> Hi
>>>> I have modified the keypressed event function in order that, when
>>>> particular keystrokes are used, jaws speaks information rather than
>>>> passing the key through to the application.  This is fine, and jaws
>>>> speaks
>>>
>>>> what I want when the keys are pressed, but also jaws passses the key
>>>> through to the app.  How can I stop the keystroke please being passed 
>>>> to
>>>> the app?
>>>>
>>>> Thank you.
>>>>
>>>> Brian Hartgen
>>>>
>>>> __________
>>>> Visit and contribute to The JAWS Script Repository
>>>> http://jawsscripts.com
>>>>
>>>> View the list's information and change your settings at
>>>> //www.freelists.org/list/jawsscripts
>>>>
>>>
>>> __________
>>> Visit and contribute to The JAWS Script Repository 
>>> http://jawsscripts.com
>>>
>>> View the list's information and change your settings at
>>> //www.freelists.org/list/jawsscripts
>>>
>>> __________
>>> Visit and contribute to The JAWS Script Repository 
>>> http://jawsscripts.com
>>>
>>> View the list's information and change your settings at
>>> //www.freelists.org/list/jawsscripts
>>>
>>>
>>
>> __________
>> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>>
>> View the list's information and change your settings at
>> //www.freelists.org/list/jawsscripts
>>
>
> __________
> Visit and contribute to The JAWS Script Repository http://jawsscripts.com
>
> View the list's information and change your settings at
> //www.freelists.org/list/jawsscripts
> 

__________ 
Visit and contribute to The JAWS Script Repository http://jawsscripts.com

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

Other related posts: