Advertisement
AutoitHacks

Explorador de Carpetas y Subcarpetas [au3]

Aug 11th, 2014
1,620
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.14 KB | None | 0 0
  1. #cs ----------------------------------------------------------------------------
  2.  AutoIt Version: 3.3.12.0
  3.  Author:         Jesux Herrera
  4.  
  5.  Script Function:
  6.     https://autoithacks.wordpress.com/
  7. #ce ----------------------------------------------------------------------------
  8. #include <ButtonConstants.au3>
  9. #include <EditConstants.au3>
  10. #include <GUIConstantsEx.au3>
  11. #include <StaticConstants.au3>
  12. #include <WindowsConstants.au3>
  13. #include <GuiEdit.au3>
  14. $Form1 = GUICreate("Explorador Subcarpetas - AutoitHacks", 380, 388, -1, -1)
  15. $Input1 = GUICtrlCreateInput("", 24, 24, 281, 21)
  16. $Button1 = GUICtrlCreateButton(".....", 304, 22, 51, 25)
  17. $Button2 = GUICtrlCreateButton("Escanear Carpeta", 24, 56, 331, 25)
  18. $Edit1 = GUICtrlCreateEdit("", 24, 96, 329, 249)
  19. $Label1 = GUICtrlCreateLabel("http://autoithacks.wordpress.com/", 88, 360, 202, 17)
  20. GUICtrlSetFont(-1, 8, 400, 0, "Verdana")
  21. GUISetState(@SW_SHOW)
  22.  
  23. While 1
  24.     $nMsg = GUIGetMsg()
  25.     Switch $nMsg
  26.         Case $GUI_EVENT_CLOSE
  27.             Exit
  28.             Case $Button1
  29.             $mensaje = "Seleccione una Carpeta"
  30.             $folder = FileSelectFolder($mensaje, "")
  31.             GUICtrlSetData($Input1, $folder)
  32.         Case $Button2
  33.             Local $SourceFolder
  34.             $source = GUICtrlRead($Input1)
  35.             Dim $FolderName = $source
  36.             Dim $FileCount = 0
  37.             ScanFolder($FolderName)
  38.     EndSwitch
  39. WEnd
  40. Func ScanFolder($SourceFolder)
  41.     Local $Search
  42.     Local $File
  43.     Local $FileAttributes
  44.     Local $FullFilePath
  45.  
  46.     $Search = FileFindFirstFile($SourceFolder & "\*.*")
  47.  
  48.     While 2
  49.         If $Search = -1 Then
  50.             ExitLoop
  51.         EndIf
  52.  
  53.         $File = FileFindNextFile($Search)
  54.         If @error Then ExitLoop
  55.  
  56.         $FullFilePath = $SourceFolder & "\" & $File
  57.         $FileAttributes = FileGetAttrib($FullFilePath)
  58.  
  59.         If StringInStr($FileAttributes,"D") Then
  60.             ScanFolder($FullFilePath)
  61.         Else
  62.             LogFile($FullFilePath)
  63.         EndIf
  64.  
  65.     WEnd
  66.  
  67.     FileClose($Search)
  68. EndFunc
  69. Func LogFile($FileName)
  70.     FileWriteLine(@ScriptDir & "\Archivos-AutoitHacks.txt",$FileName)
  71.     $FileCount += 1
  72.     _GUICtrlEdit_AppendText($Edit1, $FileName & "" & @CRLF)
  73.     Sleep(50)
  74.     FileWriteLine(@ScriptDir & "\Archivos-AutoitHacks.txt","---------------------------------------------------------------------------------")
  75. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement