Sending keystrokes to an application

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Sending keystrokes to an application

Daniel Gartmann

 

Hello,

 

Sometimes, it is necessary to send a few keystrokes to an application. Is there a way of doing this in an NVDA add-on?

 

Thanks in advance.

 

Daniel

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sending keystrokes to an application

Noelia
Hello:

You can use the send() method, for instance:

        def script_sendSomeGesture(self gesture):
                gesture.send()

Or

        def someFunction(self):
                KeyboardInputGesture.fromName(gestureName).send()

See miranda32.py app module from NVDA's core source for an example of
all this.
Thanks.
               

El 27/05/2017 a las 6:38, Daniel Gartmann escribió:

>
>
> Hello,
>
>
>
> Sometimes, it is necessary to send a few keystrokes to an application. Is
> there a way of doing this in an NVDA add-on?
>
>
>
> Thanks in advance.
>
>
>
> Daniel
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sending keystrokes to an application

Daniel Gartmann

Thanks a lot.
In which module is the send() method defined?

Daniel


-----Oprindelig meddelelse-----
Fra: Noelia [mailto:[hidden email]]
Sendt: 27. maj 2017 09:36
Til: NVDA screen reader development <[hidden email]>
Emne: Re: [Nvda-devel] Sending keystrokes to an application

Hello:

You can use the send() method, for instance:

        def script_sendSomeGesture(self gesture):
                gesture.send()

Or

        def someFunction(self):
                KeyboardInputGesture.fromName(gestureName).send()

See miranda32.py app module from NVDA's core source for an example of all this.
Thanks.
               

El 27/05/2017 a las 6:38, Daniel Gartmann escribió:

>
>
> Hello,
>
>
>
> Sometimes, it is necessary to send a few keystrokes to an application. Is
> there a way of doing this in an NVDA add-on?
>
>
>
> Thanks in advance.
>
>
>
> Daniel
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>
>
>
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sending keystrokes to an application

Noelia
Hi, the send() method is in inputcore.py.
Cheers.

El 28/05/2017 a las 11:24, Daniel Gartmann escribió:

>
> Thanks a lot.
> In which module is the send() method defined?
>
> Daniel
>
>
> -----Oprindelig meddelelse-----
> Fra: Noelia [mailto:[hidden email]]
> Sendt: 27. maj 2017 09:36
> Til: NVDA screen reader development <[hidden email]>
> Emne: Re: [Nvda-devel] Sending keystrokes to an application
>
> Hello:
>
> You can use the send() method, for instance:
>
> def script_sendSomeGesture(self gesture):
> gesture.send()
>
> Or
>
> def someFunction(self):
> KeyboardInputGesture.fromName(gestureName).send()
>
> See miranda32.py app module from NVDA's core source for an example of all this.
> Thanks.
>
>
> El 27/05/2017 a las 6:38, Daniel Gartmann escribió:
>>
>>
>> Hello,
>>
>>
>>
>> Sometimes, it is necessary to send a few keystrokes to an application. Is
>> there a way of doing this in an NVDA add-on?
>>
>>
>>
>> Thanks in advance.
>>
>>
>>
>> Daniel
>>
>>
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Check out the vibrant tech community on one of the world's most
>> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>
>>
>>
>> _______________________________________________
>> Nvda-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sending keystrokes to an application

Daniel Gartmann

Hi,

I tried to make a script for Notepad that will place focus on the "Edit" menu by sending Left-Alt followed by Right Arrow to the application. The below code doesn't run. I would be greatful if someone could point me to what might be wrong in the below code. Thanks:


***** Beginning of code ****
import appModuleHandler
import ui
from keyboardHandler import KeyboardInputGesture


class AppModule(appModuleHandler.AppModule):
        def Script_gotoRediger(self, gesture):
                # Should move to the "Edit" menu in Notepad.
                KeyboardInputGesture.fromName("left alt").send()
                KeyboardInputGesture.fromName("right arrow").send()
                ui.message"u"Slut ")
        __gestures={
                "kb:NVDA+r": "gotoRediger",
        }



-----



Oprindelig meddelelse-----
Fra: Noelia [mailto:[hidden email]]
Sendt: 28. maj 2017 12:03
Til: NVDA screen reader development <[hidden email]>
Emne: Re: [Nvda-devel] Sending keystrokes to an application

Hi, the send() method is in inputcore.py.
Cheers.

El 28/05/2017 a las 11:24, Daniel Gartmann escribió:

>
> Thanks a lot.
> In which module is the send() method defined?
>
> Daniel
>
>
> -----Oprindelig meddelelse-----
> Fra: Noelia [mailto:[hidden email]]
> Sendt: 27. maj 2017 09:36
> Til: NVDA screen reader development <[hidden email]>
> Emne: Re: [Nvda-devel] Sending keystrokes to an application
>
> Hello:
>
> You can use the send() method, for instance:
>
> def script_sendSomeGesture(self gesture):
> gesture.send()
>
> Or
>
> def someFunction(self):
> KeyboardInputGesture.fromName(gestureName).send()
>
> See miranda32.py app module from NVDA's core source for an example of all this.
> Thanks.
>
>
> El 27/05/2017 a las 6:38, Daniel Gartmann escribió:
>>
>>
>> Hello,
>>
>>
>>
>> Sometimes, it is necessary to send a few keystrokes to an
>> application. Is there a way of doing this in an NVDA add-on?
>>
>>
>>
>> Thanks in advance.
>>
>>
>>
>> Daniel
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> --------- Check out the vibrant tech community on one of the world's
>> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>
>>
>>
>> _______________________________________________
>> Nvda-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>
>
> ----------------------------------------------------------------------
> -------- Check out the vibrant tech community on one of the world's
> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot 
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>
>
> ----------------------------------------------------------------------
> -------- Check out the vibrant tech community on one of the world's
> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot 
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sending keystrokes to an application

Joseph Lee
Hi,
One of the reasons it won't work is because Alt key isn't sent, and the keyboard gestures won't instantiate at all (from what I can tell). In this case, a slightly more reliable way of achieving this is object navigation emulation, although when you put focus to it, the menu will open.
Cheers,
Joseph

-----Original Message-----
From: Daniel Gartmann [mailto:[hidden email]]
Sent: Sunday, May 28, 2017 12:45 PM
To: 'NVDA screen reader development' <[hidden email]>
Subject: Re: [Nvda-devel] Sending keystrokes to an application


Hi,

I tried to make a script for Notepad that will place focus on the "Edit" menu by sending Left-Alt followed by Right Arrow to the application. The below code doesn't run. I would be greatful if someone could point me to what might be wrong in the below code. Thanks:


***** Beginning of code ****
import appModuleHandler
import ui
from keyboardHandler import KeyboardInputGesture


class AppModule(appModuleHandler.AppModule):
        def Script_gotoRediger(self, gesture):
                # Should move to the "Edit" menu in Notepad.
                KeyboardInputGesture.fromName("left alt").send()
                KeyboardInputGesture.fromName("right arrow").send()
                ui.message"u"Slut ")
        __gestures={
                "kb:NVDA+r": "gotoRediger",
        }



-----



Oprindelig meddelelse-----
Fra: Noelia [mailto:[hidden email]]
Sendt: 28. maj 2017 12:03
Til: NVDA screen reader development <[hidden email]>
Emne: Re: [Nvda-devel] Sending keystrokes to an application

Hi, the send() method is in inputcore.py.
Cheers.

El 28/05/2017 a las 11:24, Daniel Gartmann escribió:

>
> Thanks a lot.
> In which module is the send() method defined?
>
> Daniel
>
>
> -----Oprindelig meddelelse-----
> Fra: Noelia [mailto:[hidden email]]
> Sendt: 27. maj 2017 09:36
> Til: NVDA screen reader development <[hidden email]>
> Emne: Re: [Nvda-devel] Sending keystrokes to an application
>
> Hello:
>
> You can use the send() method, for instance:
>
> def script_sendSomeGesture(self gesture):
> gesture.send()
>
> Or
>
> def someFunction(self):
> KeyboardInputGesture.fromName(gestureName).send()
>
> See miranda32.py app module from NVDA's core source for an example of all this.
> Thanks.
>
>
> El 27/05/2017 a las 6:38, Daniel Gartmann escribió:
>>
>>
>> Hello,
>>
>>
>>
>> Sometimes, it is necessary to send a few keystrokes to an
>> application. Is there a way of doing this in an NVDA add-on?
>>
>>
>>
>> Thanks in advance.
>>
>>
>>
>> Daniel
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> --------- Check out the vibrant tech community on one of the world's
>> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>
>>
>>
>> _______________________________________________
>> Nvda-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>
>
> ----------------------------------------------------------------------
> -------- Check out the vibrant tech community on one of the world's
> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot 
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>
>
> ----------------------------------------------------------------------
> -------- Check out the vibrant tech community on one of the world's
> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot 
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sending keystrokes to an application

Joseph Lee
In reply to this post by Daniel Gartmann
Hi,
Actually, the issue has to do with how you named the function: in NVDA world, we use camel case, so instead of "Script_name", it should be "script_name".
Cheers,
Joseph

-----Original Message-----
From: Daniel Gartmann [mailto:[hidden email]]
Sent: Sunday, May 28, 2017 12:45 PM
To: 'NVDA screen reader development' <[hidden email]>
Subject: Re: [Nvda-devel] Sending keystrokes to an application


Hi,

I tried to make a script for Notepad that will place focus on the "Edit" menu by sending Left-Alt followed by Right Arrow to the application. The below code doesn't run. I would be greatful if someone could point me to what might be wrong in the below code. Thanks:


***** Beginning of code ****
import appModuleHandler
import ui
from keyboardHandler import KeyboardInputGesture


class AppModule(appModuleHandler.AppModule):
        def Script_gotoRediger(self, gesture):
                # Should move to the "Edit" menu in Notepad.
                KeyboardInputGesture.fromName("left alt").send()
                KeyboardInputGesture.fromName("right arrow").send()
                ui.message"u"Slut ")
        __gestures={
                "kb:NVDA+r": "gotoRediger",
        }



-----



Oprindelig meddelelse-----
Fra: Noelia [mailto:[hidden email]]
Sendt: 28. maj 2017 12:03
Til: NVDA screen reader development <[hidden email]>
Emne: Re: [Nvda-devel] Sending keystrokes to an application

Hi, the send() method is in inputcore.py.
Cheers.

El 28/05/2017 a las 11:24, Daniel Gartmann escribió:

>
> Thanks a lot.
> In which module is the send() method defined?
>
> Daniel
>
>
> -----Oprindelig meddelelse-----
> Fra: Noelia [mailto:[hidden email]]
> Sendt: 27. maj 2017 09:36
> Til: NVDA screen reader development <[hidden email]>
> Emne: Re: [Nvda-devel] Sending keystrokes to an application
>
> Hello:
>
> You can use the send() method, for instance:
>
> def script_sendSomeGesture(self gesture):
> gesture.send()
>
> Or
>
> def someFunction(self):
> KeyboardInputGesture.fromName(gestureName).send()
>
> See miranda32.py app module from NVDA's core source for an example of all this.
> Thanks.
>
>
> El 27/05/2017 a las 6:38, Daniel Gartmann escribió:
>>
>>
>> Hello,
>>
>>
>>
>> Sometimes, it is necessary to send a few keystrokes to an
>> application. Is there a way of doing this in an NVDA add-on?
>>
>>
>>
>> Thanks in advance.
>>
>>
>>
>> Daniel
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> --------- Check out the vibrant tech community on one of the world's
>> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>
>>
>>
>> _______________________________________________
>> Nvda-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>
>
> ----------------------------------------------------------------------
> -------- Check out the vibrant tech community on one of the world's
> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot 
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>
>
> ----------------------------------------------------------------------
> -------- Check out the vibrant tech community on one of the world's
> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot 
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sending keystrokes to an application

Noelia
In reply to this post by Daniel Gartmann
Hi, I suppose this is a simple test. So I suggest you to look code examples:

1. script word should be writen in lowercase, followed by _ and the
script name.
2. ui.message accepts a string as a parameter, that is, a quote between ()
3. Check the right name of gestures. You can do this pressing NVDA+1 by
default, to open the input help, then for instance alt, or whatever
keystroke, and then deactivate input help. After that you can go to the
NVDA log, from tools menu, to check the right names. It seems you have
right a space between left and alt, for instance.
Also consider Joseph suggestions too, and cancel speech if you want to
send a message different to the focused objects.
Cheers.
El 28/05/2017 a las 21:45, Daniel Gartmann escribió:

>
> Hi,
>
> I tried to make a script for Notepad that will place focus on the "Edit" menu by sending Left-Alt followed by Right Arrow to the application. The below code doesn't run. I would be greatful if someone could point me to what might be wrong in the below code. Thanks:
>
>
> ***** Beginning of code ****
> import appModuleHandler
> import ui
> from keyboardHandler import KeyboardInputGesture
>
>
> class AppModule(appModuleHandler.AppModule):
> def Script_gotoRediger(self, gesture):
> # Should move to the "Edit" menu in Notepad.
> KeyboardInputGesture.fromName("left alt").send()
> KeyboardInputGesture.fromName("right arrow").send()
> ui.message"u"Slut ")
> __gestures={
> "kb:NVDA+r": "gotoRediger",
> }
>
>
>
> -----
>
>
>
> Oprindelig meddelelse-----
> Fra: Noelia [mailto:[hidden email]]
> Sendt: 28. maj 2017 12:03
> Til: NVDA screen reader development <[hidden email]>
> Emne: Re: [Nvda-devel] Sending keystrokes to an application
>
> Hi, the send() method is in inputcore.py.
> Cheers.
>
> El 28/05/2017 a las 11:24, Daniel Gartmann escribió:
>>
>> Thanks a lot.
>> In which module is the send() method defined?
>>
>> Daniel
>>
>>
>> -----Oprindelig meddelelse-----
>> Fra: Noelia [mailto:[hidden email]]
>> Sendt: 27. maj 2017 09:36
>> Til: NVDA screen reader development <[hidden email]>
>> Emne: Re: [Nvda-devel] Sending keystrokes to an application
>>
>> Hello:
>>
>> You can use the send() method, for instance:
>>
>> def script_sendSomeGesture(self gesture):
>> gesture.send()
>>
>> Or
>>
>> def someFunction(self):
>> KeyboardInputGesture.fromName(gestureName).send()
>>
>> See miranda32.py app module from NVDA's core source for an example of all this.
>> Thanks.
>>
>>
>> El 27/05/2017 a las 6:38, Daniel Gartmann escribió:
>>>
>>>
>>> Hello,
>>>
>>>
>>>
>>> Sometimes, it is necessary to send a few keystrokes to an
>>> application. Is there a way of doing this in an NVDA add-on?
>>>
>>>
>>>
>>> Thanks in advance.
>>>
>>>
>>>
>>> Daniel
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> --------- Check out the vibrant tech community on one of the world's
>>> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>
>>>
>>>
>>> _______________________________________________
>>> Nvda-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>>
>>
>> ----------------------------------------------------------------------
>> -------- Check out the vibrant tech community on one of the world's
>> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Nvda-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>
>>
>> ----------------------------------------------------------------------
>> -------- Check out the vibrant tech community on one of the world's
>> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Nvda-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sending keystrokes to an application

Joseph Lee
Hi,
In this case, noelia's suggestions will work, and NVDA+R is taken by OCR add-on (for reference).
Cheers,
Joseph

-----Original Message-----
From: Noelia [mailto:[hidden email]]
Sent: Sunday, May 28, 2017 1:11 PM
To: NVDA screen reader development <[hidden email]>
Subject: Re: [Nvda-devel] Sending keystrokes to an application

Hi, I suppose this is a simple test. So I suggest you to look code examples:

1. script word should be writen in lowercase, followed by _ and the script name.
2. ui.message accepts a string as a parameter, that is, a quote between () 3. Check the right name of gestures. You can do this pressing NVDA+1 by default, to open the input help, then for instance alt, or whatever keystroke, and then deactivate input help. After that you can go to the NVDA log, from tools menu, to check the right names. It seems you have right a space between left and alt, for instance.
Also consider Joseph suggestions too, and cancel speech if you want to send a message different to the focused objects.
Cheers.
El 28/05/2017 a las 21:45, Daniel Gartmann escribió:

>
> Hi,
>
> I tried to make a script for Notepad that will place focus on the "Edit" menu by sending Left-Alt followed by Right Arrow to the application. The below code doesn't run. I would be greatful if someone could point me to what might be wrong in the below code. Thanks:
>
>
> ***** Beginning of code ****
> import appModuleHandler
> import ui
> from keyboardHandler import KeyboardInputGesture
>
>
> class AppModule(appModuleHandler.AppModule):
> def Script_gotoRediger(self, gesture):
> # Should move to the "Edit" menu in Notepad.
> KeyboardInputGesture.fromName("left alt").send()
> KeyboardInputGesture.fromName("right arrow").send()
> ui.message"u"Slut ")
> __gestures={
> "kb:NVDA+r": "gotoRediger",
> }
>
>
>
> -----
>
>
>
> Oprindelig meddelelse-----
> Fra: Noelia [mailto:[hidden email]]
> Sendt: 28. maj 2017 12:03
> Til: NVDA screen reader development <[hidden email]>
> Emne: Re: [Nvda-devel] Sending keystrokes to an application
>
> Hi, the send() method is in inputcore.py.
> Cheers.
>
> El 28/05/2017 a las 11:24, Daniel Gartmann escribió:
>>
>> Thanks a lot.
>> In which module is the send() method defined?
>>
>> Daniel
>>
>>
>> -----Oprindelig meddelelse-----
>> Fra: Noelia [mailto:[hidden email]]
>> Sendt: 27. maj 2017 09:36
>> Til: NVDA screen reader development <[hidden email]>
>> Emne: Re: [Nvda-devel] Sending keystrokes to an application
>>
>> Hello:
>>
>> You can use the send() method, for instance:
>>
>> def script_sendSomeGesture(self gesture):
>> gesture.send()
>>
>> Or
>>
>> def someFunction(self):
>> KeyboardInputGesture.fromName(gestureName).send()
>>
>> See miranda32.py app module from NVDA's core source for an example of all this.
>> Thanks.
>>
>>
>> El 27/05/2017 a las 6:38, Daniel Gartmann escribió:
>>>
>>>
>>> Hello,
>>>
>>>
>>>
>>> Sometimes, it is necessary to send a few keystrokes to an
>>> application. Is there a way of doing this in an NVDA add-on?
>>>
>>>
>>>
>>> Thanks in advance.
>>>
>>>
>>>
>>> Daniel
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> --------- Check out the vibrant tech community on one of the world's
>>> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>
>>>
>>>
>>> _______________________________________________
>>> Nvda-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>>
>>
>> ----------------------------------------------------------------------
>> -------- Check out the vibrant tech community on one of the world's
>> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Nvda-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>
>>
>> ----------------------------------------------------------------------
>> -------- Check out the vibrant tech community on one of the world's
>> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Nvda-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|

Re: Sending keystrokes to an application

Daniel Gartmann
In reply to this post by Noelia

Yes. Thanks. It worked after doing what you propose.
The trick of reading the script name via the NVDA log is awesome.

Mil gracias!



-----Oprindelig meddelelse-----
Fra: Noelia [mailto:[hidden email]]
Sendt: 28. maj 2017 22:11
Til: NVDA screen reader development <[hidden email]>
Emne: Re: [Nvda-devel] Sending keystrokes to an application

Hi, I suppose this is a simple test. So I suggest you to look code examples:

1. script word should be writen in lowercase, followed by _ and the script name.
2. ui.message accepts a string as a parameter, that is, a quote between () 3. Check the right name of gestures. You can do this pressing NVDA+1 by default, to open the input help, then for instance alt, or whatever keystroke, and then deactivate input help. After that you can go to the NVDA log, from tools menu, to check the right names. It seems you have right a space between left and alt, for instance.
Also consider Joseph suggestions too, and cancel speech if you want to send a message different to the focused objects.
Cheers.
El 28/05/2017 a las 21:45, Daniel Gartmann escribió:

>
> Hi,
>
> I tried to make a script for Notepad that will place focus on the "Edit" menu by sending Left-Alt followed by Right Arrow to the application. The below code doesn't run. I would be greatful if someone could point me to what might be wrong in the below code. Thanks:
>
>
> ***** Beginning of code ****
> import appModuleHandler
> import ui
> from keyboardHandler import KeyboardInputGesture
>
>
> class AppModule(appModuleHandler.AppModule):
> def Script_gotoRediger(self, gesture):
> # Should move to the "Edit" menu in Notepad.
> KeyboardInputGesture.fromName("left alt").send()
> KeyboardInputGesture.fromName("right arrow").send()
> ui.message"u"Slut ")
> __gestures={
> "kb:NVDA+r": "gotoRediger",
> }
>
>
>
> -----
>
>
>
> Oprindelig meddelelse-----
> Fra: Noelia [mailto:[hidden email]]
> Sendt: 28. maj 2017 12:03
> Til: NVDA screen reader development <[hidden email]>
> Emne: Re: [Nvda-devel] Sending keystrokes to an application
>
> Hi, the send() method is in inputcore.py.
> Cheers.
>
> El 28/05/2017 a las 11:24, Daniel Gartmann escribió:
>>
>> Thanks a lot.
>> In which module is the send() method defined?
>>
>> Daniel
>>
>>
>> -----Oprindelig meddelelse-----
>> Fra: Noelia [mailto:[hidden email]]
>> Sendt: 27. maj 2017 09:36
>> Til: NVDA screen reader development <[hidden email]>
>> Emne: Re: [Nvda-devel] Sending keystrokes to an application
>>
>> Hello:
>>
>> You can use the send() method, for instance:
>>
>> def script_sendSomeGesture(self gesture):
>> gesture.send()
>>
>> Or
>>
>> def someFunction(self):
>> KeyboardInputGesture.fromName(gestureName).send()
>>
>> See miranda32.py app module from NVDA's core source for an example of all this.
>> Thanks.
>>
>>
>> El 27/05/2017 a las 6:38, Daniel Gartmann escribió:
>>>
>>>
>>> Hello,
>>>
>>>
>>>
>>> Sometimes, it is necessary to send a few keystrokes to an
>>> application. Is there a way of doing this in an NVDA add-on?
>>>
>>>
>>>
>>> Thanks in advance.
>>>
>>>
>>>
>>> Daniel
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> --------- Check out the vibrant tech community on one of the world's
>>> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>>>
>>>
>>>
>>> _______________________________________________
>>> Nvda-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>>
>>
>> ----------------------------------------------------------------------
>> -------- Check out the vibrant tech community on one of the world's
>> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Nvda-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>
>>
>> ----------------------------------------------------------------------
>> -------- Check out the vibrant tech community on one of the world's
>> most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>> _______________________________________________
>> Nvda-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Nvda-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/nvda-devel
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel