Skip to content

Instantly share code, notes, and snippets.

@codeofdusk
Created February 25, 2019 17:42
Show Gist options
  • Save codeofdusk/a5d5f44f942fe8b41f3517f99964d40a to your computer and use it in GitHub Desktop.
Save codeofdusk/a5d5f44f942fe8b41f3517f99964d40a to your computer and use it in GitHub Desktop.
An NVDA global plugin to test UI Automation support.
import api
import globalPluginHandler
from scriptHandler import script
import ui
uiaState = False
uiaApp = None
focus = None
old = None
def force(hwnd):
"Always returns True."
return True
class GlobalPlugin(globalPluginHandler.GlobalPlugin):
@script(gesture="kb:NVDA+alt+u")
def script_toggleForceUIAutomation(self, gesture):
global uiaState, uiaApp, old
focus = api.getFocusObject()
if not uiaState:
uiaApp = focus.appModule
old = uiaApp.isGoodUIAWindow
uiaApp.isGoodUIAWindow = force
uiaState = True
ui.message("UI automation forceably enabled")
else:
uiaApp.isGoodUIAWindow = old
uiaState = False
ui.message("UI automation override disabled")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment