Rishav Posted October 3, 2008 Share Posted October 3, 2008 (edited) Hi folksNeed your help again. I am currently working on automating a .Net application. This application has a form with drop down menus in it. Something like;I need to select an item from the menu, say \"Green\" (based on the string and not the item sequence number) and then click OK.The problem is that i have tried several approaches but i am unable to select an item from the drop down. Nothing seems to happen.Can anyone help me stamp out the stupidity that i have forced in on my code?btw, the field is a combobox where typing of text is disabled.WinActivate(\"AppWindow\") ControlCommand(\"AppWindow\",\"Name:\",\"[CLASS:WindowsForms10.COMBOBOX.app.0.378734a; INSTANCE:2]\",\"SelectString\",\"Standard\") ControlSend(\"AppWindow\",\"Name:\",\"[CLASS:WindowsForms10.COMBOBOX.app.0.378734a; INSTANCE:2]\",\"{ENTER}\") MsgBox(0, \"\", \"Block 1:Continue??!!\")WinActivate(\"AppWindow\") ControlListView(\"AppWindow\",\"Name:\",\"[CLASS:WindowsForms10.COMBOBOX.app.0.378734a; INSTANCE:2]\",\"Select\",\"Standard\") ControlSend(\"AppWindow\",\"Name:\",\"[CLASS:WindowsForms10.COMBOBOX.app.0.378734a; INSTANCE:2]\",\"{ENTER}\") MsgBox(0, \"\", \"Block 2:Continue??!!\")WinActivate(\"AppWindow\") $NameIndex = ControlListView(\"AppWindow\",\"Name:\",\"[CLASS:WindowsForms10.COMBOBOX.app.0.378734a; INSTANCE:2]\",\"FindItem\",\"Standard\") If $NameIndex <> -1 Then ControlListView(\"AppWindow\",\"Name:\",\"[CLASS:WindowsForms10.COMBOBOX.app.0.378734a; INSTANCE:2]\",\"Select\",$NameIndex) ControlSend(\"AppWindow\",\"Name:\",\"[CLASS:WindowsForms10.COMBOBOX.app.0.378734a; INSTANCE:2]\",\'{ENTER}\') Else MsgBox(0,\'Not Found\',$NameIndex & \' was not found.\') EndIfWinActivate(\"AppWindow\") #include <GuiListView.au3> $hwnd = ControlGetHandle(\"AppWindow\",\"Name:\",\"[CLASS:WindowsForms10.COMBOBOX.app.0.378734a; INSTANCE:2]\") For $i = 0 to _GUICtrlListView_GetItemCount($hwnd) _GUICtrlListView_SetItemSelected($hwnd,$i,True) Next ControlSend(\"AppWindow\",\"Name:\",\"[CLASS:WindowsForms10.COMBOBOX.app.0.378734a; INSTANCE:2]\",\'{ENTER}\') Edited October 3, 2008 by Rishav Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 3, 2008 Share Posted October 3, 2008 Automating .Net forms is usually a difficult and sometimes disastrous process. The class names are generated at runtime and usually aren't the same between runs. Try looking at the form with the window tool again and you can see what I mean. There's a script floating around in the example scripts named "anygui" or something like that. See if that will help you. 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