Manipulating ComboBox class

Mar 1, 2013 at 12:57 AM
HI all

I am trying to use WASP to manipulate a drop down list box. I am able to navigate to the control which reports its class as a ComboBox. However I am unable to manipulate the control in any way. The available memebers are:
PS G:\> $db_combo | Get-Member


   TypeName: Huddled.Wasp.Control

Name             MemberType Definition
----             ---------- ----------
Activate         Method     System.Void Activate()
Close            Method     System.Void Close()
Equals           Method     bool Equals(System.Object obj), bool Equals(Huddled.Wasp.WindowHandle wnd)
GetChildren      Method     System.Collections.Generic.List[Huddled.Wasp.WindowHandle] GetChildren()
GetClassName     Method     string GetClassName()
GetHashCode      Method     int GetHashCode()
GetIsActive      Method     bool GetIsActive()
GetIsMaximized   Method     bool GetIsMaximized()
GetIsMinimized   Method     bool GetIsMinimized()
GetMainWindow    Method     Huddled.Wasp.Window GetMainWindow()
GetParent        Method     System.IntPtr GetParent()
GetParentOrOwner Method     System.IntPtr GetParentOrOwner()
GetPosition      Method     System.Drawing.Rectangle GetPosition()
GetProcessId     Method     int GetProcessId()
GetType          Method     type GetType()
GetWindowText    Method     string GetWindowText()
IsAppWindow      Method     bool IsAppWindow(), bool IsAppWindow(bool includeToolWindows)
Maximize         Method     System.Void Maximize()
Minimize         Method     System.Void Minimize()
PointToScreen    Method     System.Drawing.Point PointToScreen(System.Drawing.Point origin), System.Drawing.Point PointToScreen(int X, int Y)
Restore          Method     System.Void Restore()
SetPosition      Method     System.Void SetPosition(System.Drawing.Rectangle value), System.Void SetPosition(int x, int y, int width, int height)
SetSize          Method     System.Void SetSize(int width, int height)
ToString         Method     string ToString()
Class            Property   System.String Class {get;}
Handle           Property   System.IntPtr Handle {get;set;}
Title            Property   System.String Title {get;}
How do I find out what items populate the drop down list and how to select one of them?
Coordinator
Mar 1, 2013 at 6:55 AM
I am not sure -- you should be able to either check the Title property or call .GetWindowText,() on it to see the current value. I can't remember a way to get a list using the Win32 APIs right now other than that, and using SendKeys (up/down, or just type the name you want). to cycle through them.

With the WASP2 module that I've been working on you can access it using UIAutomation which will get you the list, and let you specify the one you want ... I guess I really should put that code on this page as a beta so people can use it .. I'm just frustrated because it's hard to make it "powershelly"

Anyway, just as an example, on the PuTTY Configuration Window, I can set the Parity like so:
$Combo = Select-UIElement -Process Putty | Select-UIElement Parity -Type ComboBox 

# List out the items (because I was scripting interactively)
$Combo | Select-UIElement -Type ListItem  -Recurse # | Select-Object -Expand Name

# Now pick one of them and select it:
$Combo | Select-UIElement "Even" -Type ListItem  -Recurse | Invoke-SelectionItem.Select
Incidentally, you see there part my problem with this vs. the current WASP: that whole "Invoke-SelectionItem.Select" thing is awkward...
Mar 6, 2013 at 4:30 AM
Edited Mar 6, 2013 at 4:31 AM
I've tried using SendKeys but it does not seem to work reliably. It might be to do with the fact that I am trying to automate a Uniface GUI and it is behaving in a none standard way. Though WASP does correctly identify the elements in the GUI which gave me some hope initially.

How can I try your new WASP2 code? Can you point me to some setup instructions.

Thanks!
Apr 13, 2013 at 8:09 PM
I just started using the WASP2 project recently...this is how i set it up:
  1. Download the UI Automation as well as the Reflection and Autoload modules
  2. Rename the files as:
Autoload.psm1"
Reflection.psm1"
UIAutomation.psm1"

(I removed the file version numbers from the example so that these instructions don't become out of date with the next release of any module)

Load the modules with the commands:
Import-Module .\Autoload.psm1
Import-Module .\Reflection.psm1
Import-Module .\UIAutomation.psm1
I hope this helps.

-Scott
Coordinator
Apr 14, 2013 at 3:04 AM
Yeah, I'm working on a packaging module that will resolve dependencies so that I can distribute it easier :)