Soundarya Posted March 28, 2023 Posted March 28, 2023 My desktop application already have a combo box with options listed. I have used "_GUICtrlComboBox_SetCurSel", to select the option that I need. The combo box Edit area is updated with the new value as I selected using "_GUICtrlComboBox_SetCurSel". Then I have a button which I can click and it shows which option is selected. Though the combo box displayed the option I selected, the message still shows my default value. Then when I manually go and click the combo box drop down and click on the option in drop down, then the message displays the correct option. I think _GUICtrlComboBox_SetCurSel is just changing the test in edit area and really not selecting the option ? Code Local $hDTP = ControlGetHandle( $Control, "", "WindowsForms10.COMBOBOX.app.0.bb8560_r18_ad11") _GUICtrlComboBox_SetCurSel($hDTP,10) It changes the combo box value from "System 3" to "Integration". But when I try to submit the job it is still referring "System 3" When I go ahead and change manually it is working fine
Developers Jos Posted March 28, 2023 Developers Posted March 28, 2023 (edited) Moved to the appropriate forum. This is the second time so please simply use the support forum when you don't know were to post it! Moderation Team Edited March 28, 2023 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Soundarya Posted March 28, 2023 Author Posted March 28, 2023 Jos Sorry I thought I should post under technical support. I will make sure to post under Support forum.
Danp2 Posted March 28, 2023 Posted March 28, 2023 Have you tried using _GUICtrlComboBox_SelectString instead of _GUICtrlComboBox_SetCurSel? Latest Webdriver UDF Release Webdriver Wiki FAQs
Soundarya Posted March 28, 2023 Author Posted March 28, 2023 Hi Danp, yes I tried and it is doing the same activity as _GUICtrlComboBox_SetCurSel
Nine Posted March 28, 2023 Posted March 28, 2023 Maybe you could try to show the dropdown (_GUICtrlComboBox_ShowDropDown), then select the value you want _GUICtrlComboBox_SetCurSel, and then ControlClick on it. Just an idea, but don't know if it would work though... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
Solution Soundarya Posted March 28, 2023 Author Solution Posted March 28, 2023 Finally with multiple trial and errors found a solution. Adding the code if it might help anyone struggling with same problem Local $hDTP = ControlGetHandle( $Control, "", "WindowsForms10.COMBOBOX.app.0.bb8560_r18_ad11") ControlClick($Control,"","WindowsForms10.COMBOBOX.app.0.bb8560_r18_ad11") Local $hCTR = ControlCommand($Control,"","WindowsForms10.COMBOBOX.app.0.bb8560_r18_ad11","ShowDropDown","") _GUICtrlComboBox_SelectString($hDTP,"Integration") Local $iSelect = _GUICtrlComboBox_GetCurSel($hDTP) ControlClick($hCTR,"",$iSelect)
Danp2 Posted March 28, 2023 Posted March 28, 2023 Hmmm... there are a few things that you could try -- Use_GUICtrlComboBox_ShowDropDown to show dropdown prior to making the selection. Then hide it afterwards if needed. Use alternate UDFs from GuiComboBoxEx.au3 Use ControlCommand / SelectString to set the combo box's selection Use UI Automation Pwned by @Nine and @Soundarya Latest Webdriver UDF Release Webdriver Wiki FAQs
Soundarya Posted March 28, 2023 Author Posted March 28, 2023 Thanks Nine, it did worked. I followed similar approach you have suggested. I have handled the combo box using ControlGetHandle. Then I did controlcommand to show the dropdown. Then using GUICtrlComboBox_SelectString, I have sent my selection. The I got the index of the selection using _GUICtrlComboBox_GetCurSel, then did a control click on it
Soundarya Posted March 28, 2023 Author Posted March 28, 2023 @Danp2 Thanks, I tried the same and glad it worked. Thanks for suggesting the solution.
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