Getting Developer Info on an UIAElement in Console

Karl-Otto Rosenqvist

Hi there!
Today I got a bit further in my effort to make a grid accessible with the following lines.

// Get the UIASelectionPattern from the grid
selpat = self._getUIAPattern(UIAHandler.UIA_SelectionPatternId,UIAHandler.IUIAutomationSelectionPattern)

// Get what's selected
cursel = selpat.GetCurrentSelection()

// Loop through the selection parts and speak them
for i in range(cursel.Length):
selement = cursel.GetElement(i)
// Speak the column header
// Now I want to get the value that's selected
valpat = selement._getUIAPattern(UIAHandler.UIA_ValuePatternId,UIAHandler.IUIAutomationValuePattern)

When I try to get hold of the UIAValuePattern from the UIAElement to get the text in the cell the following appears in the log.

Traceback (most recent call last):
File "scriptHandler.pyo", line 192, in executeScript
File "C:\Users\Karl-Otto\AppData\Roaming\nvda\scratchpad\appModules\", line 54, in script_readGridRow
File "comtypes\__init__.pyo", line 277, in __getattr__
AttributeError: _getUIAPattern

It doesn't seem as the object stored in my variable selement that I get from the GetElement() has that pattern. In C# it works and looks like this:

var s = sourceElement.GetCurrentPattern(SelectionPattern.Pattern) as SelectionPattern;

foreach (var c in s.Current.GetSelection())
var v = c.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern;
} // foreach

Is it possible to display the dev info for a variable containing an object as you do with NVDA + F1? If that's possible in Python Console I can execute code to get to a oint where I can inspect that variable to see what's availible.

Best regards


Karl-Otto Rosenqvist
Orgnr: 750804-3937
0701- 75 98 56

Join to automatically receive all group messages.