Hi all,
I now have some revised code but as far as I can tell, the commands are not
being executed. The way I checked this was to set the logging level to input
output and then restart NVDA with my plugin. I checked the logs but did not find
any entries relating to the say battery status command which is what I am trying
to execute as a test.
import globalPluginHandler
import keyboardHandler
from globalCommands import commands
import tones
from logHandler import log
class GlobalPlugin(globalPluginHandler.GlobalPlugin):
def makeKeyName(self,knm):
colonSplit=knm.split(":")
tk=colonSplit[1]
nvm="insert"
if(tk.startswith("NVDA")):
tKey=tk.replace("NVDA",nvm)
else:
tKey=tk
return tKey
"take commands from speech-recognition and send them to NVDA"
def execCommand(self,action):
log.info("exec method running")
for key in commands._GlobalCommands__gestures:
funcName=commands._GlobalCommands__gestures[key]
# log.info("the key name is " + key + " value is " +
commands._GlobalCommands__gestures[key])
if(key.startswith("kb:")):
if (action=="sayline") and (funcName=="say_battery_status"):
tones.beep(550 , 100)
log.info("match found")
keyboardHandler.KeyboardInputGesture.fromName(self.makeKeyName(key))
def __init__(self):
super(GlobalPlugin, self).__init__()
self.execCommand("sayline")
-----Original Message-----
From: nvda-addons-bounce@xxxxxxxxxxxxx [mailto:nvda-addons-bounce@xxxxxxxxxxxxx]
On Behalf Of James Scholes
Sent: Monday, July 13, 2015 3:00 PM
To: nvda-addons@xxxxxxxxxxxxx
Subject: [nvda-addons] Re: Executing NVDA commands programmatically
Pranav Lal wrote:
PL] Thanks for the pointers. I tried your commands but strangely was
unable to set focus to the speech viewer to check.
I am working on a desktop so battery status may not be available.