Re: Inserting additional speech commands based on focus change

Yukio Nozawa

Hello Noeria,

It works! In order to avoid duplicated speech, it quits event callbacks chain by not calling nextHandler. Might affect other addons, but I still do not need to care about that since it's currently an experimental phase.

Thank you very much!

On 2021/09/12 15:05, Noelia Ruiz wrote:
Hello, you may do something like this (tested inscratchpad:

import globalPluginHandler
import speech
from speech.commands import PitchCommand
import controlTypes

class GlobalPlugin(globalPluginHandler.GlobalPlugin):

def event_gainFocus(self, obj, nextHandler):
speech.speakObject(obj, controlTypes.OutputReason.FOCUS,

Please see the new module, speech.speakObject and
speech.speakObjectProperties methods. Also you can see to see how the CallBack command canbe implemented

2021-09-11 18:11 GMT+02:00, Yukio Nozawa <>:

I want to hook the focus change event, see the new control's role and
insert additional speech command sequence so that I can control how the
focused control is announced. It's like more generalized version of
"Beep before cap" where that specific function is handled manually
inside the speech module.

I haven't involved in NVDA addon development for several years. I still
remember that I can set a callback for focus change event, but not sure
if it's possible to insert speech command values and pass them to the
actual speech.speak(speechSequence) call.

speech.getObjectPropertiesSpeech seems to be generating speech sequence
for focused object, but I don't know if intercepting this function is

Any tips for implementing this? Has anyone tried to do similar tweeks?


Yukio Nozawa

Keio University

Faculty of Environment and Information Studies

Jun Murai Laboratory. KUMO Research Group

personal e-mail:



Join to automatically receive all group messages.