Automationuser 1 Posted June 28, 2013 Hi Everyone, I have an window's application which is built on C++. I want to automate double click on a subitem in a listview and enter data. I have gone through _GUICtrlListView_ClickItem() function, but this doesn't allow to click on a subitem. how can this be done?? Please help. Share this post Link to post Share on other sites
Automationuser 1 Posted July 1, 2013 Hell All, Can someone help me on this? I tried a lot, but still not able to get the solution Share this post Link to post Share on other sites
TheSaint 2,450 Posted July 1, 2013 As always, we help those who help themselves. That means, that you need to present us with the code you've used so far, so that we can detect any errors you may have made and so that we don't have to code something from scratch for you. Saves time all around, especially for us volunteers. P.S. All except trancexx, who is a special case and doesn't want to be classed as 'we' or 'us' or even a volunteer (especially one that doesn't like getting unsolicited PM's). Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage) Share this post Link to post Share on other sites
water 2,359 Posted July 1, 2013 To automate the listview of another application function ControlGetHandle seems to be a good starting point. But, as The Saint already said, post what you have already tried and we will see how we can help. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki  Share this post Link to post Share on other sites
Automationuser 1 Posted July 1, 2013 $HWD=controlgethandle("TestApp","","[CLASS:SysListView32; INSTANCE:1]") _GUICtrlListView_ClickItem($HWD,0," "," ",2) I want to double click on the subitem of the index 0 Share this post Link to post Share on other sites
Automationuser 1 Posted December 9, 2013 Hi Guys, Can anyone help me with this. Still I am not able to double click on the second column in a list view Share this post Link to post Share on other sites
mikell 1,007 Posted December 9, 2013 If you use the dbleclick optional parameter then you must define the preceding ones Did you try _GUICtrlListView_ClickItem($HWD, 0, "left", False, 2) Share this post Link to post Share on other sites
Automationuser 1 Posted December 10, 2013 @Mikell, I want to double click on the subitem. _GUICtrlListView_ClickItem() doesn't have subitem parameter. Share this post Link to post Share on other sites
mikell 1,007 Posted December 10, 2013 (edited) Here is a scent But... I've got absolutely no idea of how this can work or not on an external listview (not tested) expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <WindowsConstants.au3> $gui = GUICreate("", 300, 450) Local $listView = GUICtrlCreateListView("A|B|C|D|E|F|G", 20, 20, 250, 350, -1, $LVS_EX_GRIDLINES) For $i = 0 To 20 GUICtrlCreateListViewItem("A" & $i & "|B" & $i & "|C" & $i & "|D" & $i & "|E" & $i & "|F" & $i & "|G" & $i, $listView) Next $listView = GUICtrlGetHandle($listView) ;the example didn't work when used with ControlID. $label1 = GuiCtrlCreateLabel("item", 50, 380, 50, 17) $input1 = GuiCtrlCreateInput("1", 100, 380, 30, 17) $label2 = GuiCtrlCreateLabel("subitem", 50, 400, 50, 17) $input2 = GuiCtrlCreateInput("1", 100, 400, 30, 17) $btn = GuiCtrlCreateButton("click", 150, 390, 50, 25) GUISetState() Do $nMsg = GUIGetMsg() Switch $nMsg Case $btn $it = GuiCtrlRead($input1)+1 $subit = GuiCtrlRead($input2) $aRect = _GUICtrlListView_GetSubItemRect($listView, $it, $subit) $iX = ($aRect[0]+$aRect[2])/2 $iY = ($aRect[1]+$aRect[3])/2 _GUICtrlListView_EnsureVisible($listView, 2, True) Local $iMode = Opt("MouseCoordMode", 2) Local $aPos = MouseGetPos() _WinAPI_ShowCursor(False) MouseClick("left", $iX, $iY, 2, 1) $sSubitem = GetItemClicked($listView) ; <<<< this is for the test MouseMove($aPos[0], $aPos[1], 0) _WinAPI_ShowCursor(True) Opt("MouseCoordMode", $iMode) If $sSubitem <>"" Then Msgbox(0,"", $sSubitem & ": was clicked") ; <<<< this too EndSwitch Until $nMsg = $GUI_EVENT_CLOSE Func GetItemClicked( $hListView ) $aInfo = _GUICtrlListView_SubItemHitTest( $hlistView ) If $aInfo[0] = -1 Or $aInfo[1] = -1 Then Return SetError(2, 0, -1) If IsArray($aInfo) = 0 Then Return SetError(1, 0, -1) ;get the item/subitem text. Return _GUICtrlListView_GetItemText($hlistView, $aInfo[0], $aInfo[1]) EndFunc Edited December 10, 2013 by mikell Share this post Link to post Share on other sites
Automationuser 1 Posted December 11, 2013 Thanks Mikell, This doesn't work on external application Is there any other way. to do this?? Or _GUICtrlListView_ClickItem() should be modified to include subitem? Share this post Link to post Share on other sites