PowerShell In GUI Blog

PowerShell GUI Box Just In A Few Clicks

Archive for the ‘tip’ Category

Tip of the day: setting the size of browser’s window

leave a comment »

Sometimes, you need to set a window to a particular size. Not a problem, in the one-liner below we start Firefox and set height and width:

Start-SeFirefox | ConvertTo-SeAutomationElement | Invoke-UIAWindowTransformResize -TransformResizeWidth 500 -TransformResizeHeight 200;
Advertisements

Written by Alexander Petrovskiy

September 6, 2012 at 6:15 pm

Posted in Powershell, tip

Tagged with

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