antonioj84 Posted September 9, 2015 Posted September 9, 2015 expandcollapse popup;Hi there I am trying to to search a specific path c:\Documents and settings\rogers\Local Settings ;the code below work but can someone point how to define the path directly, instead of searching the folder then click to select and so on ; this code below work, it finds each folder click until Local settings $hWnd5 = WinGetHandle($Title,"") Sleep(300) $hlist = ControlGetHandle($hWnd5, "", "SysListView322") $listid = _GUICtrlListView_FindText($hlist,"Documents and Settings" ) _GUICtrlListView_ClickItem($hlist, $listid, "left", False, 2) Sleep(100) $hlist = ControlGetHandle($hWnd5, "", "SysListView322") $listid = _GUICtrlListView_FindText($hlist,"rogers" ) _GUICtrlListView_ClickItem($hlist, $listid, "left", False, 2) Sleep(100) $hlist = ControlGetHandle($hWnd5, "", "SysListView322") $listid = _GUICtrlListView_FindText($hlist,"Local Settings" ) _GUICtrlListView_ClickItem($hlist, $listid, "left", False, 1) **************************************************************************************************************************************************************** ;This code below does Not work some ideas ;$spath = "C:\" ;$sgettext = ControlTreeView($Title,"","SysTreeView322", "select", $spath) ;$spath = "C:\ | Documents and Settings" ;$sgettext = ControlTreeView($Title,"","SysTreeView322", "select", $spath) ;$spath = "Documents and Settings | rogers" ;$sgettext = ControlTreeView($Title,"","SysTreeView322", "select", $spath) ;$spath = "Documents and Settings | rogers| Local Settings" ;$sgettext = ControlTreeView($Title,"","SysTreeView322", "select", $spath) ;ConsoleWrite($spath &@CRLF) ;$Selectall = ControlListView($hWnd5, "", "SysListView322", $sgettext) ;$Finditem = ControlListView($hWnd5, "", "SysListView322", "Finditem", "Local Settings") ;$Select = ControlListView($hWnd5, "", "SysListView322", "Select",$Finditem) ; consolewrite($Select)
Danyfirex Posted September 9, 2015 Posted September 9, 2015 Run('explorer.exe /select, ' & @SystemDir)Saludos antonioj84 1 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
antonioj84 Posted September 9, 2015 Author Posted September 9, 2015 ;Hi dany, does work , however the behaviour is not correct. The script open a new explorer window, which I do not want , see the picture I want to work in the current window Run('explorer.exe /select,c:\Documents and settings\rogers\Local Settings') ; open a new explorer windows
antonioj84 Posted September 10, 2015 Author Posted September 10, 2015 I have this code working can someone point me how to delete folder "Test2 include <RecFileListToArray.au3> #include <WinAPIFiles.au3> $Ssearch = _RecFileListToArray("c:\Test1\","*.*", 0, 1) For $i = 1 To UBound($Ssearch) - 1 ConsoleWrite($Ssearch[$i] & @CRLF) FileDelete($Ssearch[$i]) ;ConsoleWrite("FileDelete(" & $Ssearch[$i] & ")" & @CRLF) Next here is the result in console I want to delete everthing after Test1 --> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop Test2\ Test2\KeyFinderInstaller.exe Test2\results.xml
jguinch Posted September 10, 2015 Posted September 10, 2015 DirRemove Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
antonioj84 Posted September 10, 2015 Author Posted September 10, 2015 Not deleting I tried , I am trying to delete Test2 folder with everyting inside #include <RecFileListToArray.au3> #include <WinAPIFiles.au3> $Ssearch = _RecFileListToArray("c:\Test1\","*.*", 0, 1) Local $deleteDR = $Ssearch For $i = 1 To UBound($Ssearch) - 1 ;FileDelete($Ssearch[$i]) ;ConsoleWrite("FileDelete(" & $Ssearch[$i] & ")" & @CRLF) DirRemove($Ssearch[$i],1) ConsoleWrite($Ssearch[$i] & @CRLF) Next DirRemove($deleteDR,1) **************************************************** console Test2\ Test2\KeyFinderInstaller.exe Test2\results.xml
antonioj84 Posted September 11, 2015 Author Posted September 11, 2015 I found this code orginally from SlimShady and I modify it, works like a charm. Hope it can helps someone. include<File.au3> local $folder1 = "C:\Test1\Test2\" ; this will delete anything after Test2, including folder directory and so on.. _DirRemoveContents($folder1, "*.*") Func _DirRemoveContents($folder,$f) Local $list_of_contents, $status $list_of_contents = _FileListToArray($folder) If IsArray($list_of_contents) Then If StringRight($folder, 1) <> "\" Then $folder = $folder & "\" If @error = 1 Then Return 1 ; No Files\Folders Found For $a = 1 To $list_of_contents[0] FileSetAttrib($folder & "\" & $list_of_contents[$a], "-RASH") If StringInStr(FileGetAttrib($folder & $list_of_contents[$a]), "D") Then $status = DirRemove($folder & $list_of_contents[$a], 1) Else $status = FileDelete($folder & $list_of_contents[$a]) EndIf Next Else Return 2 ; Directory doesn't exists EndIf EndFunc ;==>_DirRemoveContents
antonioj84 Posted September 11, 2015 Author Posted September 11, 2015 I found this code orginally from SlimShady and I modify it, works like a charm. Hope it can helps someone. include<File.au3> local $folder1 = "C:\Test1\Test2\" ; this will delete anything after Test2, including folder directory and so on.. _DirRemoveContents($folder1) Func _DirRemoveContents($folder) Local $list_of_contents, $status $list_of_contents = _FileListToArray($folder) If IsArray($list_of_contents) Then If StringRight($folder, 1) <> "\" Then $folder = $folder & "\" If @error = 1 Then Return 1 ; No Files\Folders Found For $a = 1 To $list_of_contents[0] FileSetAttrib($folder & "\" & $list_of_contents[$a], "-RASH") If StringInStr(FileGetAttrib($folder & $list_of_contents[$a]), "D") Then $status = DirRemove($folder & $list_of_contents[$a], 1) Else $status = FileDelete($folder & $list_of_contents[$a]) EndIf Next Else Return 2 ; Directory doesn't exists EndIf EndFunc ;==>_DirRemoveContents
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