Tag Archives: the Start button
Task: click the Computer item in the Start menu.
Requirements: use UIAutomation to demonstrate the technique.
Solution: although the solution is simple, it may be difficult to find out. The current version of UIAutomationSpy is slightly outdated and not yet recommends using the Get-UIADesktop cmdlet. Okay, this time we’ll do it manually, having in mind that a newer version of UIAutomationSpy is promised.
Here is the solution. At first, we open the Start menu by clicking the Start button. After that, we are seeking for a window that is the underlying level which the menu is placed upon. Finally, we get a list item, called of course Computer and send a Win32 click to there.
This sample is not ready to globalization.
ipmo [path]\UIAutomation.dll; # click the Start button and open the Start menu Get-UIADesktop | Get-UIAButton -Name Start | Invoke-UIAButtonClick; # Navigating through the Start menu and clicking the list item of our interest Get-UIADesktop | Get-UIAcontrol -Class 'DV2ControlHost' -Name 'Start menu' | Get-UIAPane -Class 'DesktopSpecialFolders' | Get-UIAListItem -Name 'Computer' | Invoke-UIAControlClick;
After the code is processed by PowerShell, the Computer folder is open.