lugi Posted August 29, 2007 Share Posted August 29, 2007 I need to set select string of combobox control, which is a form created by .NET fromwork 2.0, I get the control information from AutoIt v3 window info Class is "WindowsForms10.COMBOBOX.app.0.3ce0bb8" Instance is 3 So my autoit script is ControlCommand("My Form", "", "[CLASS:WindowsForms10.COMBOBOX.app.0.3ce0bb8; INSTANCE:3]", "SelectString", "Customer") but it did not work does anyone know why? Thanks. Link to comment Share on other sites More sharing options...
herewasplato Posted August 29, 2007 Share Posted August 29, 2007 ...does anyone know why? Thanks.Welcome to the forum.Not to insult you, but have you set Opt/WinTitleMatchMode to mode 4?Also, remember what the help files says about controls:Note: AutoIt only works with standard Microsoft controls - some applications write their own custom controls which may look like a standard MS control but may resist automation. Experiment!Sadly, just because .NET is an MS product, it may not respond as desired to all of AutoIt's ControlCommand functions.You might also try a ControlFocus line before your ControlCommand line. Check the return from the ControlFocus line.-MSP- [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
lugi Posted August 30, 2007 Author Share Posted August 30, 2007 I'm sure that even set WinTitleMatchMode to 4 still does not work,The ControlFocus works OK, but I still get no way to select the combo box,Since the .NET has become popular within last five years, and seems will become more popular in future,should AutoIt have a good support for this kind of application?Welcome to the forum.Not to insult you, but have you set Opt/WinTitleMatchMode to mode 4?Also, remember what the help files says about controls:Note: AutoIt only works with standard Microsoft controls - some applications write their own custom controls which may look like a standard MS control but may resist automation. Experiment!Sadly, just because .NET is an MS product, it may not respond as desired to all of AutoIt's ControlCommand functions.You might also try a ControlFocus line before your ControlCommand line. Check the return from the ControlFocus line.-MSP- Link to comment Share on other sites More sharing options...
lugi Posted August 30, 2007 Author Share Posted August 30, 2007 Hello Larry, Have you tried to select a combobox string with autoit? the combobox is a .NET control, System.Windows.Forms.ComboBox, and have some items "red/green/blue" i want to choose the "green" item, so my autoit script is like this: ControlCommand("My Form", "", "[CLASS:WindowsForms10.COMBOBOX.app.0.3ce0bb8; INSTANCE:3]", "SelectString", "green") but it did not work, do you know how to achieve this? Thanks I have used AutoIt with .NET applications without trouble. Without the app, or more script example, or AutoIt Window Info screenshots, we are making uneducated guesses. Lar. Link to comment Share on other sites More sharing options...
lugi Posted August 31, 2007 Author Share Posted August 31, 2007 Please upload a simple .net app so we can test.Lar.Here is a very simple app with autoit script, you need .net 2.0 runtime to run this app.SelectCombo.rar Link to comment Share on other sites More sharing options...
lugi Posted September 4, 2007 Author Share Posted September 4, 2007 There seems to be a filter on built in "ControlCommand" so that only "ComboBox" class controls can be affected... use this for you... ComboSelect("My Form","","WindowsForms10.COMBOBOX.app.0.378734a1","green") Func ComboSelect($title,$text,$ctrl,$item) Local Const $CB_SELECTSTRING = 0x014D Local $hwnd = ControlGetHandle($title,$text,$ctrl) Local $ret = DLLCall("user32.dll","int","SendMessage", _ "hwnd",$hwnd, _ "int",$CB_SELECTSTRING, _ "int",-1, _ "str",$item) Return ($ret[0] > -1) EndFunc Thank you! The script works great! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now