PowerShell In GUI Blog

PowerShell GUI Box Just In A Few Clicks

Archive for August 2012

Tip of the day: using wildcards in UIAutomation

leave a comment »

One of amazing features of PowerShell cmdlets is supporting so-called wildcards. What are wildcards? The characters that substitute one or more, or even all of the characters in the string.
For example, you need to simplify your code:

Start-Process calc -PassThru | Get-UIAWindow | Get-UIAButton -Name a* | Invoke-UIAButtonClick;

This code presses the plus button, the button that is named Add.
Imagine that you need to press the Reciprocal button and you’ll immediately love wildcards.


Written by Alexander Petrovskiy

August 26, 2012 at 9:17 am

Posted in Powershell, tip

Tagged with