Get Name of Get-UiaText

Sep 14, 2015 at 7:09 PM
Edited Sep 14, 2015 at 7:11 PM
I would like to get the name of Get-UiaText and store it in a variable.

I though the following might be how to do this:
$variable_name = Get-UiaText -AutomationId '1606' -Class 'Static' | Read-UiaControlName
but that gives me this error:
Get-UiaText : A part of the pipeline input is null
At line:1 char:1
+ Get-UiaText -AutomationId '1606' -Class 'Static' | Read-UiaControlName;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Get-UiaText], Exception
    + FullyQualifiedErrorId : PartOfInputIsNull,UIAutomation.Commands.GetUiaTextCommand
Get-UiaText : failed to get control in 2000 milliseconds by: title: '', automationId: '1606', className: 'Static', value: ''.
At line:1 char:1
+ Get-UiaText -AutomationId '1606' -Class 'Static' | Read-UiaControlName;
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationTimeout: (:) [Get-UiaText], Exception
    + FullyQualifiedErrorId : ControlIsNull,UIAutomation.Commands.GetUiaTextCommand
Sep 14, 2015 at 7:20 PM
So, looks like I need to add '-Name *', this works:
$variable_name = Get-UiaText -AutomationId '1606' -Class 'Static' -Name * | Read-UiaControlName