pgv Posted April 15, 2009 Share Posted April 15, 2009 Hi Experts How do I select a particular item from comboBox currently I am using the following code. ;$a =ControlCommand("Select User or Group","","1032","Selectstring","abc") $a=ControlClick("Select User or Group","","Button9[,Click]") the strings and id's I got are by using autoit win info any help is greatly appreciated Link to comment Share on other sites More sharing options...
martin Posted April 15, 2009 Share Posted April 15, 2009 Hi Experts How do I select a particular item from comboBox currently I am using the following code. ;$a =ControlCommand("Select User or Group","","1032","Selectstring","abc") $a=ControlClick("Select User or Group","","Button9[,Click]") the strings and id's I got are by using autoit win info any help is greatly appreciatedCan you say what the problem is with $a =ControlCommand("Select User or Group","","1032","Selectstring","abc")? This line $a=ControlClick("Select User or Group","","Button9[,Click]") should be $a=ControlClick("Select User or Group","","Button9") The square brackets [,Clicks] means that the parameter clicks is optional so you don't have to include it. If you don't include it then it is assumed that the number of times to click is 1 (the default). If you do include it you have to use the number of clicks like this $a=ControlClick("Select User or Group","","Button9",2);for 2 clicks Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
pgv Posted April 17, 2009 Author Share Posted April 17, 2009 I have made some changes... Thanks for the suggestions, applied the code you suggested but does not click on the item required in the comboBox. I have made some changes to the code.. $pText = "Select User or Groups" $hListView1 = ControlGetHandle($pText, "", "[CLASS:ComboBox;INSTANCE:1]") $cblist=_GUICtrlComboBox_GetList($hListView1) For $j= 0 to $cblist -1 $cbarr=_GUICtrlComboBox_GetListArray ($hListView1) sleep(2000) MsgBox(1, "", _ArrayToString($cbarr, "",1,1)) Msgbox(1,"",$cblist) Next Any help is much appreciated. pgv Can you say what the problem is with $a =ControlCommand("Select User or Group","","1032","Selectstring","abc")? This line $a=ControlClick("Select User or Group","","Button9[,Click]") should be $a=ControlClick("Select User or Group","","Button9") The square brackets [,Clicks] means that the parameter clicks is optional so you don't have to include it. If you don't include it then it is assumed that the number of times to click is 1 (the default). If you do include it you have to use the number of clicks like this $a=ControlClick("Select User or Group","","Button9",2);for 2 clicks Link to comment Share on other sites More sharing options...
pgv Posted April 17, 2009 Author Share Posted April 17, 2009 all I am doing is to clikc on a particular item in a combobox ControlClick("Select User or Group", "","[CLASS:ComboBox;INSTANCE:1]") {THIS WILL CLICK ON THE COMBOBOX} USING THE FUNTION BELOW IA M TRYING GET THE ITEM LIST AND THEN PICK ONE ITEM FROM THE LIST OF ITEMS ---------------------------------------------------------------------------------------------------- Func _cmb() $pText = "Select User or Groups" $cmbview = ControlGetHandle($pText, "", "[CLASS:ComboBox;INSTANCE:1]") $l=_GUICtrlComboBox_GetList($pText) MsgBox(1,"",$l) $res=_GUICtrlComboBox_FindString($cmbview,"abc") msgbox(1,"",$res) Sleep(2000) ;Msgbox(1,"",$cblist) EndFunc Please see attachement , I am trying to select one of the domain among the 6 in the drop down list ------------------------------------- I have made some changes... Thanks for the suggestions, applied the code you suggested but does not click on the item required in the comboBox. I have made some changes to the code.. $pText = "Select User or Groups" $hListView1 = ControlGetHandle($pText, "", "[CLASS:ComboBox;INSTANCE:1]") $cblist=_GUICtrlComboBox_GetList($hListView1) For $j= 0 to $cblist -1 $cbarr=_GUICtrlComboBox_GetListArray ($hListView1) sleep(2000) MsgBox(1, "", _ArrayToString($cbarr, "",1,1)) Msgbox(1,"",$cblist) Next Any help is much appreciated. pgv Link to comment Share on other sites More sharing options...
pgv Posted April 20, 2009 Author Share Posted April 20, 2009 $cmbview = ControlGetHandle($pText, "", "[CLASS:ComboBox;INSTANCE:1]") MsgBox(1,"",$cmbview) $bb=_GUICtrlComboBox_SetCurSel($cmbview,5) This will get me the selection on other combobox but does not do it for the combobox shown in the attachment. Any ideas all I am doing is to clikc on a particular item in a combobox ControlClick("Select User or Group", "","[CLASS:ComboBox;INSTANCE:1]") {THIS WILL CLICK ON THE COMBOBOX} USING THE FUNTION BELOW IA M TRYING GET THE ITEM LIST AND THEN PICK ONE ITEM FROM THE LIST OF ITEMS ---------------------------------------------------------------------------------------------------- Func _cmb() $pText = "Select User or Groups" $cmbview = ControlGetHandle($pText, "", "[CLASS:ComboBox;INSTANCE:1]") $l=_GUICtrlComboBox_GetList($pText) MsgBox(1,"",$l) $res=_GUICtrlComboBox_FindString($cmbview,"abc") msgbox(1,"",$res) Sleep(2000) ;Msgbox(1,"",$cblist) EndFunc Please see attachement , I am trying to select one of the domain among the 6 in the drop down list ------------------------------------- Link to comment Share on other sites More sharing options...
crazygamer Posted April 20, 2009 Share Posted April 20, 2009 $cmbview = ControlGetHandle($pText, "", "[CLASS:ComboBox;INSTANCE:1]") MsgBox(1,"",$cmbview) $bb=_GUICtrlComboBox_SetCurSel($cmbview,5) This will get me the selection on other combobox but does not do it for the combobox shown in the attachment. Any ideasPlease use the ControlID # in the ControlGethandle method instead of "[CLASS:ComboBox;INSTANCE:1]", It works for me Link to comment Share on other sites More sharing options...
pgv Posted April 20, 2009 Author Share Posted April 20, 2009 thanx for the response.. $han = ControlGetHandle($pText, "", "0x002E0330") MsgBox(1,"",$han) I have chnaged it to the above but it is not giving any msgbox now ....any thing I am missing.. Please use the ControlID # in the ControlGethandle method instead of "[CLASS:ComboBox;INSTANCE:1]", It works for me Link to comment Share on other sites More sharing options...
crazygamer Posted April 20, 2009 Share Posted April 20, 2009 thanx for the response..$han = ControlGetHandle($pText, "", "0x002E0330")MsgBox(1,"",$han)I have chnaged it to the above but it is not giving any msgbox now ....any thing I am missing..The control id referred to was ID in Summary tab of the Basic window info for the checkbox. eg...ControlGetHandle($pText,"",1061) Link to comment Share on other sites More sharing options...
Zedna Posted April 20, 2009 Share Posted April 20, 2009 Look herehttp://www.autoitscript.com/forum/index.ph...st&p=658067 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
pgv Posted April 20, 2009 Author Share Posted April 20, 2009 as suggested I have changed it $han = ControlGetHandle($pText,"",1005)MsgBox(1,"www",$han)_GUICtrlComboBox_SetCurSel($han,6)but still no luck, the msgbox does not display the handle idThe control id referred to was ID in Summary tab of the Basic window info for the checkbox. eg...ControlGetHandle($pText,"",1061) Link to comment Share on other sites More sharing options...
crazygamer Posted April 21, 2009 Share Posted April 21, 2009 as suggested I have changed it $han = ControlGetHandle($pText,"",1005)MsgBox(1,"www",$han)_GUICtrlComboBox_SetCurSel($han,6)but still no luck, the msgbox does not display the handle idwhether you changed the $pText value, it should be "Select user or Group" with reference to the screenshot attached... 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