Tag Archives: TaskBar

Daily automation: open an application from the TaskBar

It’s easily to activate a window that is in the Normal or Maximized window state. However, what to do if a window is minimized? There’s no problem if it’s seen in the Windows TaskBar.

Task: click the window out of Windows TaskBar.

Requirements: use UIAutomation to demostrate the technique.

Solution: below is the piece of code that does the same the user does when one needs to return the window to a visible state. Apart with Alt+Tab and Alt+Shift+Tab, there is the simple click on the application’s rectangle in TaskBar.:

ipmo [path]\UIAutomation.dll;

# use the desktop element to get the button in TaskBar
# desktop AutomationElement is nothing else but
# [System.Windows.Automation.AutomationElement]::RootElement
Get-UIADesktop | Get-UIAButton -Name 'Windows Media Player' | Invoke-UIAButtonClick;

After the code is processed by PowerShell, the window of your choice appears on the screen.

%d bloggers like this: