Romeo1998 Posted November 13, 2017 Share Posted November 13, 2017 Dear friends and respected seniors, I am trying to send keys to the selected item in a listview control in a window, but with no success. I know I am making some mistake, but I am not able to figure it out. This is the code I am using ; get window's handle Local $a = WinGetHandle( "My Program" ) ; set focus on that window WinActivate($a); ; get the listview control's handle which is in that window Local $b = ControlGetHandle($a,"",2111) ; set focus on that listview control ControlFocus($a,"",2111); ; clear all selections on that listview control ControlListView($a,"",$b,"SelectClear"); sleep(1000); ; select second item from that listview control ControlListView($a,"",$b,"Select", 1 ) sleep(1000); ; send the ENTER key to that selected item in listview control send("{Enter}") ; not working ; OR ControlSend($a,"",$b,"{ENTER}") ; not working Can anyone please kindly guide me and help me with this problem. Awaiting your replies, Thank you. Link to comment Share on other sites More sharing options...
BigDaddyO Posted November 13, 2017 Share Posted November 13, 2017 I would suggest you use one of the many _GUICtrlListView_ items instead of ControlListView Romeo1998 1 Link to comment Share on other sites More sharing options...
Romeo1998 Posted December 31, 2017 Author Share Posted December 31, 2017 Thank you Sir Link to comment Share on other sites More sharing options...
careca Posted January 1, 2018 Share Posted January 1, 2018 Something like this usually works for me: ControlListView($hWnd, "", "SysListView321", "Select", $k, $k) ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:1]") Really i think you should check the control id. Try this "SysListView321" What does it show as the ID with the info tool? Romeo1998 1 Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Romeo1998 Posted January 5, 2018 Author Share Posted January 5, 2018 Thanks Careca, I tried ur code, but it still clicks random items from the list, n not the one that i select programmatically the control id is 2111 this is the code that i tried now ;selecting the 2nd item from the list ControlListView($a, "", "[CLASS:SysListView32; INSTANCE:1]", "Select", 1) ;but this double clicks a random item from the list :( ControlClick($a, "", 2111,"left",2) It seems that i will have to create a GUI Link to comment Share on other sites More sharing options...
careca Posted January 5, 2018 Share Posted January 5, 2018 can we reproduce the issue somewhere? note that i posted "Select", $k, $k) because select can take 2 optional params. and SysListView321 not 32. try without instance 1 and with 321 instead of 32. Spoiler Renamer - Rename files and folders, remove portions of text from the filename etc. GPO Tool - Export/Import Group policy settings. MirrorDir - Synchronize/Backup/Mirror Folders BeatsPlayer - Music player. Params Tool - Right click an exe to see it's parameters or execute them. String Trigger - Triggers pasting text or applications or internet links on specific strings. Inconspicuous - Hide files in plain sight, not fully encrypted. Regedit Control - Registry browsing history, quickly jump into any saved key. Time4Shutdown - Write the time for shutdown in minutes. Power Profiles Tool - Set a profile as active, delete, duplicate, export and import. Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes. NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s. IUIAutomation - Topic with framework and examples Au3Record.exe Link to comment Share on other sites More sharing options...
Romeo1998 Posted January 5, 2018 Author Share Posted January 5, 2018 Thanks Careca, I tried syslistview32 but it didnt work , so i used SysListView323 as the autoit tool was showing ClassnameNN: SysListView323 this is the code that i tried now ;working :) ;selecting the 1st item from the list ControlListView($a, "", "SysListView323", "Select", 0,0) Sleep(2000) ; not working :| ; but these 2 codes still double click a random item from the list and not the one selected by the above code ControlClick($a, "", "SysListView323","left",2) ; OR ControlClick($a, "", 2111,"left",2) I will try to make a GUI 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