[nvda-addons] Re: Executing NVDA commands programmatically

  • From: "Pranav Lal" <pranav.lal@xxxxxxxxx>
  • To: <nvda-addons@xxxxxxxxxxxxx>
  • Date: Sat, 11 Jul 2015 19:36:53 +0530

Hi Joseph,

I found most of the commands I wanted in globalCommands.py. I have tried to
create a very small add-on to execute the function to speak the current time. My
problem is that I am not sure what to do about the gesture parameter that the
date and time script wants. I want to execute it programmatically and not with a
gesture so the gesture parameter will be blank.
The script has been defined as
def script_ Time(self,gesture):

My add-on is below

import globalPluginHandler
import globalCommands
class GlobalPlugin(globalPluginHandler.GlobalPlugin):
def script_announceDT(self, gesture):
dateTime(gesture)
Pranav

-----Original Message-----
From: nvda-addons-bounce@xxxxxxxxxxxxx [mailto:nvda-addons-bounce@xxxxxxxxxxxxx]
On Behalf Of Joseph Lee
Sent: Saturday, July 11, 2015 10:46 AM
To: nvda-addons@xxxxxxxxxxxxx
Subject: [nvda-addons] Re: Executing NVDA commands programmatically

Hi,
Yes, you do need to look at NVDA source code itself. In fact, some of the
community add-ons have borrowed ideas and user interface mechanics from NVDA
core.
Cheers,
Joseph

-----Original Message-----
From: nvda-addons-bounce@xxxxxxxxxxxxx
[mailto:nvda-addons-bounce@xxxxxxxxxxxxx] On Behalf Of Pranav Lal
Sent: Friday, July 10, 2015 10:05 PM
To: nvda-addons@xxxxxxxxxxxxx
Subject: [nvda-addons] Re: Executing NVDA commands programmatically

Hi Joseph,

Thanks for this. Where can I go to get a list of scripts that are globally
available? I am guessing I have to look at the code.

Pranav

-----Original Message-----
From: nvda-addons-bounce@xxxxxxxxxxxxx
[mailto:nvda-addons-bounce@xxxxxxxxxxxxx]
On Behalf Of Joseph Lee
Sent: Friday, July 10, 2015 9:03 PM
To: nvda-addons@xxxxxxxxxxxxx
Subject: [nvda-addons] Re: Executing NVDA commands programmatically

Hi,
For global commands, yes. You need to use:
globalCommands.GlobalCommands.script_name(gesture)
For apps, you need to test if the script can be found by using "has attribute"
function like so:
hasattr(object, "script")
Same goes with other attributes you wish to test. One useful way is to test NVDA
version indirectly by testing for presence of specific attributes in a module.
Cheers,
Joseph


-----Original Message-----
From: nvda-addons-bounce@xxxxxxxxxxxxx
[mailto:nvda-addons-bounce@xxxxxxxxxxxxx] On Behalf Of Pranav Lal
Sent: Friday, July 10, 2015 6:51 AM
To: nvda-addons@xxxxxxxxxxxxx
Subject: [nvda-addons] Executing NVDA commands programmatically

Hi all,

Is it possible to execute NVDA commands programmatically from within a NVDA
add-on? For example, if I wrote an add-on for Microsoft Word that did something
and I wanted it to read the current line, could I execute this command from
within the add-on? One way would be to execute the relevant key combination but
keys can be changed. Could I perhaps scroll through a dictionary of gestures and
or commands, find the one I want and then execute it?

Pranav

----------------------------------------------------------------
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

----------------------------------------------------------------
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

----------------------------------------------------------------
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

----------------------------------------------------------------
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

----------------------------------------------------------------
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: