• Select-Window - pick windows by process name or window caption (with wildcard support)
  • Select-ChildWindow - pick all owned windows of another window (eg: dialogs, tool windows)
  • Select-Control - pick controls (children) of a specific window, by class and/or name and/or index (with wildcard support) -- NOTE: the "Window" can be specified as "-Window 0" to get all parentless windows, which includes windows, dialogs, tooltips, etc... With -Window 0 this returns a true superset of the Select-Window output.
  • Send-Click - send mouse clicks (any button, with any modifier keys)
  • Send-Keys - Windows.Forms.SendKeys lets you send keys ... try this: Select-Window notepad | Send-Keys "%(ea)Testing{Enter}{F5}" (and for extra fun, try it with multiple notepad windows open).
  • Set-WindowActive - yeah, just activates the window
  • Set-WindowPosition - set any one of (or all of) top, left, width, height on a window ... or maximize/minimize/restore
  • Get-WindowPosition - get the position (kind-of redundant, actually, since the Window object has it's position as a property)
  • Remove-Window - closes the specified window

Last edited Jan 20, 2009 at 2:26 PM by Jaykul, version 3

Comments

klepster Mar 22, 2011 at 9:53 AM 
WOW - absolutely awesome.... I was stumbling around crafting up .NET calls to get window details - and hey presto! All the hard work was already done. Not only were my initial requirements met with Select-Window and Get-WindowPosition, but the functionality found in the Send-Keys and Send-Click have inspired me to new projects. Thanks.
- klepster

Sabbah Feb 14, 2010 at 8:57 AM 
First of all, extreamly needed to use Select-Window with PID or even it may takes input from Start-Process in pipeline? And the second, why Send-Keys doesn't actually send parentheses, ")" and "("? Correct this, please, and I will have better chances to use this stuff rather than my favorite AutoIT. By the way, AutoIT experience will be very helpful in such snapin development, maybe you should unite your efforts?

harriscj Oct 12, 2008 at 12:21 AM 
Hi Jaykul,
Cool stuff. This may be a big lifesaver for me and my team.

The link to Windows.Forms.SendKeys is broken. I think this is the link you wanted (aspx instead of asp):
http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.aspx

-seaJhawk