James,
Ignore my previous message. I remembered that I had solved my gesture mapping
issue by using the global commands dictionary so I need to find the format in
which I have to pass the name of the key to
keyboardHandler.KeyboardInputGesture.fromName.
Sorry for any confusion I may have caused.
Pranav
-----Original Message-----
From: nvda-addons-bounce@xxxxxxxxxxxxx
[mailto:nvda-addons-bounce@xxxxxxxxxxxxx] On Behalf Of James Scholes
Sent: Thursday, July 23, 2015 5:37 PM
To: nvda-addons@xxxxxxxxxxxxx
Subject: [nvda-addons] Re: Executing NVDA commands programmatically
Hi Pranav,
It just so happens that somebody else has been asking very similar questions on
the nvda-devel mailing list recently. Here's a reply from one of NVDA's lead
developers that might help.
The first thing to consider is why you're trying to directly call a--
script, as this determines the best way to do it. 1. If you're trying
to just emulate a key press from a user and you want NVDA to respond
as it always would (e.g. you want to pretend the user pressed up
arrow), use inputCore.manager.emulateGesture. Make the relevant
gesture using keyboardHandler.KeyboardInputGesture.fromName. 2. If you
want to call an NVDA specific command (e.g. you wanted to call the
date time command from another script for some reason), you should be
able to just execute the script and pass None for the gesture; e.g.
scriptHandler.executeScript(globalCommands.commands.script_dateTime,
None). However, this isn't something you really should be doing unless
there is a very good reason.