Hi James,
Many thanks. My concern with using gestures is that users can change them so I
want to call the scripts directly instead of hard coding gestures. I had tried
the approach of passing "None" as a gesture parameter but it did not work. I'll
try again.
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.