Docfxit Posted October 18, 2017 Share Posted October 18, 2017 I am trying to select a file in a window and then delete it. It works some of the time and then it stops working. When I start the script it works. A minute goes by and it stops working. The script starts by selecting the first file at MouseMove(91,338) then it deletes the file by selecting the X at MouseMove(128,291). The next file should be highlighted automatically. When it gets to the end of the script and starts over is where it doesn't select the first file in the list at MouseMove(91,338) I wanted to add a wait but I can't get AutoIt Window Info to show me how to select the first file in the list. Window Info only selects the entire box starting with Name and including all files in that box. expandcollapse popupOpt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) AutoItSetOption("TrayIconDebug", 1) ;0-off ; Set so that tray displays current line number HotKeySet("{ESC}", "_Exit") ;If you press ESC the script will stop While 1 = 1 WinWait("Find","Search &subdirectori") If Not WinActive("Find","Search &subdirectori") Then WinActivate("Find","Search &subdirectori") WinWaitActive("Find","Search &subdirectori") MouseMove(91,338) Sleep(1000) MouseUp("left") sleep(100) MouseMove(128,291) sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") sleep(100) MouseDown("left") MouseUp("left") Sleep(2000) WEnd Func _Exit() Sleep(100) Exit EndFunc ;==> _Exit() Is there a more reliable way to select the first file? Thanks, Docfxit Link to comment Share on other sites More sharing options...
Danyfirex Posted October 19, 2017 Share Posted October 19, 2017 Hello. If It is a Common Windows Control you propably could use ControlListView function. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Docfxit Posted October 19, 2017 Author Share Posted October 19, 2017 Hi Danyfirex Maybe I'm not doing this correctly. This is what is in the box: This is what the info window shows: This is the code I am using: ControlListView("Find", "", "SysListView321", "SelectAll") ControlListView("Find", "", "SysListView321", "Deselect", 2, 5) MsgBox($MB_SYSTEMMODAL, "", ControlListView("Find", "", "SysListView321", "GetText", 9, 0)) MsgBox($MB_SYSTEMMODAL, "", ControlListView("Find", "", "SysListView321", "FindItem", "14 KB", 1)) MsgBox($MB_SYSTEMMODAL, "", ControlListView("Find", "", "SysListView321", "GetSelected", 1)) This is the first message box that comes up: This is the second message box that comes up: This is part of the third message box that comes up: I don't see how to get any of it to be helpful. Thanks, Docfxit Link to comment Share on other sites More sharing options...
Danyfirex Posted October 19, 2017 Share Posted October 19, 2017 Basically you need to find your item. then select it. Maybe something like this. Local $iIndex=ControlListView("Find", "", "SysListView321" ,"FindItem","StringToFind") ControlListView("Find", "", "SysListView321" ,"Select",$iIndex) Then you could click the delete button. check if it is a clickable button/toolbar using the AutoIt window Info tool. Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
Docfxit Posted October 20, 2017 Author Share Posted October 20, 2017 After using your example, Instead of it selecting one file at a time, it selected all files in the list. Instead of me having to delete one file at a time I am able to delete all files in one selection. This means that it can delete 10,000 with one click on the delete key. This is a really great solution. This is the code I ended up with: Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) AutoItSetOption("TrayIconDebug", 1) ;0-off ; Set so that tray displays current line number Local $iIndex=ControlListView("Find", "", "SysListView321" ,"FindItem","StringToFind") ControlListView("Find", "", "SysListView321" ,"Select",$iIndex) WinWait("Find","Search &subdirectori") If Not WinActive("Find","Search &subdirectori") Then WinActivate("Find","Search &subdirectori") WinWaitActive("Find","Search &subdirectori") MouseMove(128,291) sleep(1000) MouseDown("left") MouseUp("left") Thank you very much, Docfxit 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