[nvda-addons] Re: Executing NVDA commands programmatically

  • From: James Scholes <james@xxxxxxxxxxxxx>
  • To: nvda-addons@xxxxxxxxxxxxx
  • Date: Thu, 23 Jul 2015 13:06:53 +0100

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.
--
James Scholes
http://twitter.com/JamesScholes
----------------------------------------------------------------
NVDA add-ons: A list to discuss add-on code enhancements and for reporting
bugs.

Community addons are available from: http://addons.nvda-project.org
To send a message to the list: nvda-addons@xxxxxxxxxxxxx
To change your list settings/unsubscribe:
//www.freelists.org/list/nvda-addons
To contact list moderators: nvda-addons-moderators@xxxxxxxxxxxxx

Other related posts: