Giter VIP home page Giter VIP logo

nvda-autohotkey's Introduction

NVDA and AutoHotkey

This repository was prepared as there wasn't much information available on how to use AutoHotkey with NVDA.

You need:

Tested with nvda_2019.2.1 and AutoHotkey version 1.1.32 (both 32 and 64 bit).

Usage

You can either copy and paste the code from nvda.ahk in your script or use the #Include command https://www.autohotkey.com/docs/commands/_Include.htm

#include nvda.ahk

Place nvdaControllerClient64.dll and nvdaControllerClient32.dll in the same folder as your script.

Notes - Tips

  1. NVDA itself may interrupt nvdaSpeak() so you may need to accommodate for this in your script by using a Sleep command, nvdaCancel() or a combination of both - see Tip: nvdaSpeak() may be interrupted by nvda speaking window title, problem and solution proposed
  2. If NVDA can't see a programs buttons or menus, perhaps you can try using a number of AutoHotkey commands such as MouseClick, Send {Appskey} or {Rbutton} to bring up context menus or preparing a AutoHotkey Menu or Inputbox to get simple user feedback. NVDA can see AutoHotkey Menus and GUIs so that might help - an example using MouseClick, InputBox and Menu here https://www.autohotkey.com/boards/viewtopic.php?p=307440#p307440

Functions

  • nvdaSpeak(text) - speak the text
  • nvdaCancel() - cancel speak or braille message
  • nvdaBrailleMessage(text) - send braille message, untested
  • nvdaRunning() - check if NVDA is running, returns 0 if so

Example

nvdaSpeak("Your accessibility script has been started.")

; Note that NVDA itself may interrupt nvdaSpeak() - if that causes a problem try to solve it with a Sleep or nvdaCancel() - see Notes-Tips

variable:="This is a test"
nvdaSpeak(variable)

; The clipboard is a special variable, see https://www.autohotkey.com/docs/misc/Clipboard.htm
nvdaSpeak(clipboard)

; The hotkey syntax can be found here https://www.autohotkey.com/docs/Hotkeys.htm
^1:: ; ctrl+1
nvdaSpeak("You pressed control + 1")
Return

; press Alt+S to cancel speak/braille
!s::nvdaCancel() 

#include nvda.ahk

NVDA Controller Client (DLL files)

The NVDA Controller Client API allows an application to communicate to NVDA, in order to do such things as speak text or braille a message.

The client API is implemented as a dll (dynamic link library). The functions in this dll can be called from any programming language that supports looking up and calling of any symbol in a dll (such as ctypes in Python), or by linking to it, for languages like C and C++.

License LGPLv2.1 - see license.txt in the 7z file.

Download from this repository:

nvda-autohotkey's People

Contributors

hi5 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sine-w michelsuch

nvda-autohotkey's Issues

error when running a script

I have the following script

#include nvda.ahk
^1:: ; ctrl+1
nvdaSpeak("You pressed control + 1")

however, when I run the script by clicking enter,

Error at line 148.

Line Text: aria-owns="jump-to-results"
Error: This line does not contain a recognized action.

The program will exit.

I have already put nvda.ahk and the two dll files in the same folder

Tip: nvdaSpeak() may be interrupted by nvda speaking window title, problem and solution proposed

*I am not sure this is to be posted here or somewhere else.
I think this is not the issue of the nvda ahk but how nvda interact with autohotkey
these are what I have learnt and would like to bring to everyone's attention.

Please see below as an example.
Menu, PM, Add, ellipsis โ€ฆ, PM_ellipsis
PM_ellipsis:
Clipboard := "......"
Send ^v
;I found that, if the function is simply triggered by hotkeys, like ctrl 1, then only the line nvdaSpeak is necessary
;if the process involve sending keys, menu etc, it may involve interupting the nvda speach so that below extra lines have to be added to your ahk script
;what I meant by interupted is like, after trigger the function, nvda will read the whole window title first before speaking the nvdaSpeak
;therefore without these extra line, performing this script nvda will speak like "*new 2 - Notepad++ this is a test"
sleep 100
;this line is very depending on the usage situation. I tested out that, if this line is set to disable on Notepad++, it will work, but if it is in MS Word, without sleep will be interupted
;so it may need to adjust the sleep time according to your use situation, if you found that your nvdaSpeak is interupted, try increasing sleep time
nvdaCancel()
;this is to interupt nvda of speaking the window title or anything else
nvdaSpeak("this is a test")
;just for your attention, string should be quoted in "" and variable do not need ""
;so speak clipboard will be like nvdaSpeak(Clipboard)
return

ScrollLock and nvdaCancel()

Hi,
I have the following script

ScrollLock::
nvdaCancel()
return

However, pressingScrollLock and
customized combination based on ScrollLock
nvda still report ScrollLock is on or off.

any possible solution for that?
thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.