ShrutiW Posted March 11, 2019 Posted March 11, 2019 Can I have an autoIt code form selecting an item from a combo box and set that item to the box . I tried in many ways but no luck. Please help.
Skeletor Posted March 11, 2019 Posted March 11, 2019 Let see your code first, then we help you. Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI
ShrutiW Posted March 11, 2019 Author Posted March 11, 2019 (edited) This is what I have done so far. First window gets activated properly, next popup window also gets activated but the problem is with the combo Box. Item from the drop down is not getting selected, it directly clicks on "OK" button ( In CSR Team Information Combo Box ). Don't know where I am going wrong. Please have a look at the code @Skeletor. Item in the combo Box is also gets selected, I get a message " The combo box item #3 has been selected", but the item is not set to the combo box and it clicks on "Ok" button, then I get the error message saying "select the team". That means the item is getting selected but not able to set to the combo box. Am I missing anything in the code? @Melba23 If you could help please? expandcollapse popup#include<IE.au3> #Include <GuiTreeView.au3> #include <GuiComboBox.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> ;Global Const $CB_SETCURSEL = 0x14E ;_GUICtrlComboBox_SetCurSel ( "[CLASS:ThunderRT6ComboBox ; INSTANCE:1]", -1) WinWait ("Customer Care Portal Phase-2 - Internet Explorer","") WinActivate("Customer Care Portal Phase-2 - Internet Explorer","") Sleep(2000) ;CSR Team Information Combo box WinWait ("CSR Team Information","") WinActivate("CSR Team Information","") WinWaitActive("CSR Team Information") Sleep ( 3000 ) _GUICtrlComboBox_SetCurSel("[CLASS:ThunderRT6ComboBox ; INSTANCE:1]", 3) Global $hdlComboBox = ControlGetHandle("CSR Team Information", "", "[CLASS:ThunderRT6CommandButton; INSTANCE:1]") If IsHWnd($hdlComboBox) Then If _GUICtrlComboBox_SetCurSel($hdlComboBox, 3)<> -1 Then MsgBox($MB_ICONINFORMATION, "", "The ComboBox item #3 has been selected.") Else MsgBox($MB_ICONERROR, "", "Error during the selection of the ComboBox item.") EndIf Else MsgBox($MB_ICONERROR, "", "Cannot obtain the handle of the ComboBox control." & @CRLF & "Error: " & @error) EndIf Sleep(1000) ;New Contact Window WinActivate ("New Contact","") ControlClick("Customer Care Portal Phase-2 - Internet Explorer", "","[CLASS:ThunderRT6CommandButton ; INSTANCE:16]") ;Clicks on New contact button Sleep(3000) ControlSetText ( "New Contact", "", "[CLASS:ThunderRT6TextBox; INSTANCE:6]", "H30098556") ;Enters value in textBox for for Inquired About Sleep(2000) ControlSetText ( "New Contact", "", "[CLASS:ThunderRT6TextBox; INSTANCE:5]", "H30098556") ;Enters value in textBox for for Inquired For Sleep ( 2000) ;Contact Type Combo box $h_combobox = ControlGetHandle("New Contact", "", "[CLASS:ThunderRT6ComboBox; INSTANCE:9]") $i_index = 3 ; Correspondance DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_combobox, "int", $CB_SETCURSEL, "int", $i_index, "int", 0) Sleep ( 2000 ) ;Inquiry Type Combo box $h_combobox = ControlGetHandle("New Contact", "","[CLASS:ThunderRT6ComboBox; INSTANCE:1]") $i_index = 4 ; CUSTOMER INQUIRY DllCall("user32.dll", "int", "SendMessage", "hwnd", $h_combobox, "int", $CB_SETCURSEL, "int", $i_index, "int", 0) Sleep ( 2000 ) ControlClick("New Contact","", "[CLASS:ThunderRT6CommandButton; INSTANCE:5]") ; Clicks on View Button Edited March 11, 2019 by ShrutiW
Skeletor Posted March 11, 2019 Posted March 11, 2019 Hey, I see you posted this topic twice.. why would you do this? Anyways, I saw you provide way more information on the other post... screenshots, etc... YOUR OTHER POST! My suggestion is this... If you mentioned that the second windows box is selected... then use the Send keys function and Tab your way through bundled with a Send keys of down arrow then Enter.WARNING: Dangerous to use if not handled with care. Send("{TAB 3}") ; Sends a Tab button 3 times Sleep(500) ; Because send goes throuhg within milliseconds, add a sleep so it doesnt act as fast. Send("{DOWN 5}") ; Sends a Down Arrow 5 times Send("{ENTER}") PS: Oh and @ShrutiW , word of warnign... let sleeping dogs lie ie. (Melba23)... don't tag Mods in your post. 😵 Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI
ShrutiW Posted March 11, 2019 Author Posted March 11, 2019 Sorry but I didn't got my solution that's why I posted it again. I tried using send key function and it is giving "Unable to parse line" error. 😥
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