;-------------------------------------------------------------------- ;Includes ;-------------------------------------------------------------------- #include #include #include #include #include #Include #Include #Include #include-once Opt("TrayIconDebug",1) ;-------------------------------------------------------------------- ;Declarations ;-------------------------------------------------------------------- Global $hImage, $hWndTreeView, $objFSO, $hCommonDocs, $hMyDocs Global $hSelect,$hSelect2,$hSelect2,$hSelect2_2,$file,$sText2,$hSelect3,$hSelect3_2 $extension = "au3|html" $ext = Stringsplit($extension,"|") Dim $search[10] ;-------------------------------------------------------------------- ;Declarations pour l'UDF ;-------------------------------------------------------------------- $objFSO = ObjCreate("Scripting.FileSystemObject") $hImage = _GUIImageList_Create(16, 16, 5, 3) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 15) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 6) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 8) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 3) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 7) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 4) _GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 11) ;-------------------------------------------------------------------- ;Koda ;-------------------------------------------------------------------- #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("By Tim v2.1", @DesktopWidth /1.5 + 200, @Desktopheight /1.5 +100, @DesktopWidth /6 - 100 , @Desktopheight /16) $hTreeView = _GUICtrlTreeView_Create($Form1,610, 48, 260, 550,BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT), _ $WS_EX_CLIENTEDGE) $hTreeView2 = _GUICtrlTreeView_Create($Form1,405, 48, 200, 550) $generalitem = _GUICtrlTreeView_Add($hTreeView2,0, "Scripts") _ShellTreeView_Create($hTreeView) _IEERRORHANDLERREGISTER() $IE = _IECREATEEMBEDDED() $IEOBJECT = GUICtrlCreateObj($IE, 24, 48, 377, 550) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Chercher tous les scripts sur l'ordinateur", 432, 8, 210, 33, 0) $Button3 = GUICtrlCreateInput($extension, 670, 8, 180, 18, 0) $Button2 = GUICtrlCreateButton("Executer le script visionné", 48, 8, 321, 33, 0) #EndRegion ### END Koda GUI section ### GUISetState(@SW_SHOW) ;-------------------------------------------------------------------- ;Affichage de la gui, debut du script ;-------------------------------------------------------------------- While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit; Fonction pour quitter... Mais honnetement, qui voudrait fermer un programme comme ca? Case $Button3 $extension = Guictrlread($button3) $ext = Stringsplit($extension,"|") Case $Button1 $c_q = Msgbox(4,"","Attention, cette opération peut prendre plusieurs minutes. Voulez vous continuer?") If $c_q = 6 Then _findallscripts() EndIf Case $Button2 $hSelect3 = _GUICtrlTreeView_GetSelection($hTreeView2) If $hSelect3 and $hSelect3 <> $hSelect3_2 Then $sText2 = _GUICtrlTreeView_GetText($hTreeView2, $hSelect3) ShellExecute($file & $sText2) EndIf $hSelect3_2 = $hSelect3 EndSwitch $hSelect2 = _GUICtrlTreeView_GetSelection($hTreeView2) If $hSelect2 and $hSelect2 <> $hSelect2_2 Then $sText2 = _GUICtrlTreeView_GetText($hTreeView2, $hSelect2) ; generation du fichier html FileOpen(@ScriptDir & "\ressources\script.html",2) $ts = Fileread($file & $sText2) $split = StringSplit($ts,@CRLF) $st = _ArrayToString($split," ") $html = '' & '" Filewrite(@ScriptDir & "\ressources\script.html",$html) ;Maintenant, on l'affiche :) _IENAVIGATE($IE, @ScriptDir & "\ressources\script.html") EndIf $hSelect2_2 = $hSelect2 $hSelect = _GUICtrlTreeView_GetSelection($hTreeView) If $hSelect and $hSelect <> $hSelect_2 Then $sText = _GUICtrlTreeView_GetText($hTreeView, $hSelect) $file = _ShellTreeView_GetSelected($hTreeView, $sText, $hSelect) _Get_scripts() EndIf $hSelect_2 = $hSelect Sleep(50); now, on dort pour ne pas faire trop mal au processeur WEnd ;-------------------------------------------------------------------- ;Fonction _get_scripts par Timothée, c'est elle qui va gerer l'affichage du 2eme treeview ;-------------------------------------------------------------------- Func _Get_scripts() _GUICtrlTreeView_SetText($hTreeView2, $generalitem,$file) _GUICtrlTreeView_DeleteChildren($hTreeView2, $generalitem) $extension = Guictrlread($button3) $ext = Stringsplit($extension,"|") ; Shows the filenames of all files in the current directory. FileChangeDir($file) $i = 1 For $i = 1 to $ext[0] $search[$i] = FileFindFirstFile('*.'&$ext[$i]) While $search[$i] <> -1 $file = FileFindNextFile($search) If @error Then ExitLoop _GUICtrlTreeView_AddChild($hTreeView2, $generalitem, $file) WEnd Fileclose($search[$i]) Next _GUICtrlTreeView_Expand($hTreeView2) Endfunc ;-------------------------------------------------------------------- ;Fonction _findallscripts() par Timothée, c'est elle qui va chercher tous les scripts ;-------------------------------------------------------------------- Func _findallscripts() _GUICtrlTreeView_DeleteChildren($hTreeView2, $generalitem) _GUICtrlTreeView_SetText($hTreeView2, $generalitem,"Recherche générale") ;_GUICtrlTreeView_Destroy($hTreeView) $extension = Guictrlread($Button3) $ext = Stringsplit($extension,"|") $t = 1 $i = 1 $i2 = 1 for $t = 1 to $ext[0] $var = DriveGetDrive( "all" ) If NOT @error Then ;MsgBox(4096,"", "Found " & $var[0] & " drives") For $i = 1 to $var[0] $ar_Array = _FileListToArray3 ($var[$i], "*."&$ext[$t], 1, 1, 1,"Temp|TMP") For $i2 = 1 to UBound($ar_Array) - 1 _GUICtrlTreeView_AddChild($hTreeView2, $generalitem, $ar_Array[$i2]) Next ;_ArrayDisplay($ar_Array,"") Next EndIf next _GUICtrlTreeView_Expand($hTreeView2) _GUICtrlTreeView_SelectItem($hTreeView2,_GUICtrlTreeView_GetFirstChild($hTreeView2, $generalitem)) GUICtrlSetState($Button2,$GUI_FOCUS) EndFunc ;-------------------------------------------------------------------- ;//////////////////////////////////////////////////////////////////// ;-------------------------------------------------------------------- ; Utilisation d'un UDF Anglais //////////////////////////////////// ;-------------------------------------------------------------------- ;//////////////////////////////////////////////////////////////////// ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- ;//////////////////////////////////////////////////////////////////// ;-------------------------------------------------------------------- ; Utilisation d'un UDF Anglais //////////////////////////////////// ;-------------------------------------------------------------------- ;//////////////////////////////////////////////////////////////////// ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- ;//////////////////////////////////////////////////////////////////// ;-------------------------------------------------------------------- ; Utilisation d'un UDF Anglais //////////////////////////////////// ;-------------------------------------------------------------------- ;//////////////////////////////////////////////////////////////////// ;-------------------------------------------------------------------- ;-------------------------------------------------------------------- ;//////////////////////////////////////////////////////////////////// ;-------------------------------------------------------------------- ; Utilisation d'un UDF Anglais //////////////////////////////////// ;-------------------------------------------------------------------- ;//////////////////////////////////////////////////////////////////// ;-------------------------------------------------------------------- ;NE PAS REGARDER PLUS BAS CA VA VOUS EMBROUILLER! -_- ;-------------------------------------------------------------------- ;//////////////////////////////////////////////////////////////////// ; #FUNCTION# ================================================================================================== ; Name............: _ShellTreeView_Create ; Description.....: Add TreeView items with drives structures ; Syntax..........: _ShellTreeView_Create($hTreeView) ; Parameter(s)....: $hTreeView - Handle to the TreeView control ; Return value(s).: None ; Note(s).........: Tested on AutoIt 3.2.12.1 and Windows XP SP2 ; Author(s).......: R.Gilman (a.k.a. rasim) ; ============================================================================================================== Func _ShellTreeView_Create($hTreeView) Local $RootItem, $aDrives, $hChild, $i $hWndTreeView = $hTreeView GUIRegisterMsg($WM_NOTIFY, "_TVN_ITEMEXPANDING") _GUICtrlTreeView_SetNormalImageList($hWndTreeView, $hImage) $RootItem = _GUICtrlTreeView_Add($hWndTreeView, 0, @ComputerName, 0, 0) $aDrives = DriveGetDrive("ALL") For $i = 1 To $aDrives[0] $aDrives[$i] = StringUpper($aDrives[$i]) Next For $i = 1 To $aDrives[0] Switch DriveGetType($aDrives[$i]) Case "Removable" If ($aDrives[$i] = "a:") Or ($aDrives[$i] = "b:") Then $hChild = _GUICtrlTreeView_AddChild($hWndTreeView, $RootItem, $aDrives[$i], 1, 1) ;_ShellTreeView_GetSelected($aDrives[$i], $hChild) Else _GUICtrlTreeView_AddChild($hWndTreeView, $RootItem, $aDrives[$i], 4, 4) _ShellTreeView_GetSelected($hWndTreeView, $aDrives[$i], $hChild) EndIf Case "Fixed" $hChild = _GUICtrlTreeView_AddChild($hWndTreeView, $RootItem, $aDrives[$i], 2, 2) _ShellTreeView_GetSelected($hWndTreeView, $aDrives[$i], $hChild) Case "CDROM" $hChild = _GUICtrlTreeView_AddChild($hWndTreeView, $RootItem, $aDrives[$i], 6, 6) _ShellTreeView_GetSelected($hWndTreeView, $aDrives[$i], $hChild) EndSwitch Next $hCommonDocs = _GUICtrlTreeView_AddChild($hWndTreeView, $RootItem, StringRegExpReplace(@DocumentsCommonDir, "^.*\\", ""), 3, 5) _ShellTreeView_GetSelected($hWndTreeView, @DocumentsCommonDir, $hCommonDocs) $hMyDocs = _GUICtrlTreeView_AddChild($hWndTreeView, $RootItem, StringRegExpReplace(@MyDocumentsDir, "^.*\\", ""), 3, 5) _ShellTreeView_GetSelected($hWndTreeView, @MyDocumentsDir, $hMyDocs) EndFunc ;==>_ShellTreeView_Create Func _TVN_ITEMEXPANDING($hWnd, $Msg, $wParam, $lParam) Local $tNMHDR, $hWndFrom, $iCode $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndTreeView Switch $iCode Case $TVN_ITEMEXPANDING Local $tINFO = DllStructCreate($tagNMTREEVIEW, $lParam) Local $hControl = DllStructGetData($tINFO, "NewhItem") If _GUICtrlTreeView_GetExpanded($hWndTreeView, $hControl) = False Then _ShellTreeView_GetSelected($hWndFrom, _GUICtrlTreeView_GetText($hWndFrom, $hControl), $hControl) EndIf EndSwitch EndSwitch Return "GUI_RUNDEFMSG" EndFunc ;==>_TVN_ITEMEXPANDING ; #FUNCTION# ================================================================================================== ; Name............: _ShellTreeView_GetSelected ; Description.....: Add TreeView items with directorys structures ; Syntax..........: _ShellTreeView_GetSelected($hWndTreeView, $sDrive, $hControl) ; Parameter(s)....: $hTreeView - Handle to the TreeView control ; $sDrive - String contains drive letter or text of selected TreeView item ; $hControl - Child handle ; Return value(s).: A full path to a selected directory ; Note(s).........: Tested on AutoIt 3.2.12.1 and Windows XP SP2 ; Author(s).......: R.Gilman (a.k.a. rasim) ; ============================================================================================================== Func _ShellTreeView_GetSelected($hWndTreeView, $sDrive, $hControl) Switch _IsDocDir($sDrive, $hControl) Case 1 $sDrive = @DocumentsCommonDir Case 2 $sDrive = @MyDocumentsDir EndSwitch If Not FileExists($sDrive) Then Local $hParent = _GUICtrlTreeView_GetParentHandle($hWndTreeView, $hControl), $iFullPath If _GUICtrlTreeView_GetText($hWndTreeView, $hParent) = StringRegExpReplace(@DocumentsCommonDir, "^.*\\", "") Then $iFullPath = @DocumentsCommonDir & "\" & $sDrive ElseIf _GUICtrlTreeView_GetText($hWndTreeView, $hParent) = StringRegExpReplace(@MyDocumentsDir, "^.*\\", "") Then $iFullPath = @MyDocumentsDir & "\" & $sDrive Else $iFullPath = _GUICtrlTreeView_GetText($hWndTreeView, $hParent) & "\" & $sDrive EndIf While 1 If $hParent = 0 Then Return If FileExists($iFullPath) Then ExitLoop $hParent = _GUICtrlTreeView_GetParentHandle($hWndTreeView, $hParent) If _GUICtrlTreeView_GetText($hWndTreeView, $hParent) = StringRegExpReplace(@DocumentsCommonDir, "^.*\\", "") Then $iFullPath = @DocumentsCommonDir & "\" & $iFullPath ElseIf _GUICtrlTreeView_GetText($hWndTreeView, $hParent) = StringRegExpReplace(@MyDocumentsDir, "^.*\\", "") Then $iFullPath = @DocumentsCommonDir & "\" & $iFullPath Else $iFullPath = _GUICtrlTreeView_GetText($hWndTreeView, $hParent) & "\" & $iFullPath EndIf WEnd $sDrive = $iFullPath EndIf _GUICtrlTreeView_DeleteChildren($hWndTreeView, $hControl) Local $objFolder, $colSubFolder, $objSubFolder, $iSubChild, $iSub $objFolder = $objFSO.GetFolder($sDrive & "\") $colSubFolder = $objFolder.SubFolders For $objSubFolder In $colSubFolder $iSubChild = _GUICtrlTreeView_AddChild($hWndTreeView, $hControl, $objSubFolder.Name, 3, 5) $iSub = _GetSub($objSubFolder.Path) If $iSub Then _GUICtrlTreeView_AddChild($hWndTreeView, $iSubChild, $iSub, 3, 3) Next Return $sDrive EndFunc ;==>_ShellTreeView_GetSelected Func _IsDocDir($sPath, $hControl) If ($sPath = StringRegExpReplace(@DocumentsCommonDir, "^.*\\", "")) And ($hControl = $hCommonDocs) Then Return 1 ElseIf ($sPath = StringRegExpReplace(@MyDocumentsDir, "^.*\\", "")) And ($hControl = $hMyDocs) Then Return 2 Else Return False EndIf EndFunc ;==>_IsDocDir Func _GetSub($sPath) Local $objFolder, $colSubFolder, $objSubFolder $objFolder = $objFSO.GetFolder($sPath & "\") $colSubFolder = $objFolder.SubFolders For $objSubFolder In $colSubFolder If $objSubFolder.Name Then Return $objSubFolder.Name Next EndFunc ;==>_GetSub Func _FileListToArray3($sPath, $sFilter = "*", $iFlag = 0, $iRecurse = 0, $iBaseDir = 1, $sExclude = ""); ** still need to use RegExp to eliminate dupes? *** If $sFilter = -1 Then $sFilter = "*" If StringRight($sPath, 1) == "\" Then $sPath = StringTrimRight($sPath, 1) Local $hSearch, $sFile, $sFileString, $asList[1], $sep = "|", $sFileString1, $sFilter1 = $sFilter If Not FileExists($sPath) Then Return SetError(1, 1, "") If (StringInStr($sFilter, "\")) Or (StringInStr($sFilter, "/")) Or (StringInStr($sFilter, ":")) Or (StringInStr($sFilter, ">")) Or (StringInStr($sFilter, "<")) Or (StringStripWS($sFilter, 8) = "") Then Return SetError(2, 2, "") If Not ($iFlag = 0 Or $iFlag = 1 Or $iFlag = 2) Then Return SetError(3, 3, "") ;~ $sFilter = StringReplace("*" & $sFilter & "*", "**", "*") If Not StringInStr($sFilter, ';') And Not StringInStr($sFilter, '|') Then $sFilter &= "|" If StringInStr($sFilter, ';') Then $sep = ";";$sFilter &= ';' Local $aFilterSplit = StringSplit(StringStripWS($sFilter, 8), $sep), $sRead, $sHoldSplit, $arFolders[2] = [ $sPath, ""] ;~ $cw = ConsoleWrite("UBound($aFilterSplit) =" & UBound($aFilterSplit) & @LF) If $sExclude <> "" Then $sExclude = "(?i)" & StringReplace(StringReplace(StringReplace($sExclude, ".", "\."), "*", ".*"), "?", ".");change the filters to RegExp filters If $iRecurse Then;$cw = ConsoleWrite("UBound($aFilterSplit) =" & UBound($aFilterSplit) & @LF) If $iFlag = 2 Then _FileListToArrayFolders($sPath, $sFileString1, "*", $iRecurse, $sExclude) If $iFlag <> 2 Then _FileListToArrayFolders($sPath, $sFileString1, "*", $iRecurse, "") Local $arFolders = StringSplit(StringTrimRight($sFileString1, 1), "*") $arFolders[0] = $sPath EndIf For $iCF = 0 To UBound($arFolders) - 1; $cw = ConsoleWrite("$iCF=" & $iCF & " $arFolders[$iCF] =" & @LF & $arFolders[$iCF] & @LF) If StringStripWS($arFolders[$iCF], 8) = '' Then ContinueLoop For $iCC = 1 To UBound($aFilterSplit) - 1 If StringStripWS($aFilterSplit[$iCC], 8) = '' Then ContinueLoop If StringLeft($aFilterSplit[$iCC], 1) == "." Then $aFilterSplit[$iCC] = "*" & $aFilterSplit[$iCC] ;, "**", "*") $sFilter = StringReplace("*" & $sFilter & "*", "**", "*") Select; options for not recursing; quicker than filtering after for single directory Case Not $iRecurse And Not $iFlag And Not $iBaseDir ; fastest, with files and folders, not recursed _FileListToArrayBrief2($arFolders[$iCF], $sFileString, $aFilterSplit[$iCC], $sExclude) Case Not $iFlag; not $iRecurse and And $iBaseDir ;fast, with files and folders, not recursed _FileListToArrayBrief1($arFolders[$iCF], $sFileString, $aFilterSplit[$iCC], $sExclude) Case $iFlag = 1;fast, with files only, not recursed _FileListToArrayFiles($arFolders[$iCF], $sFileString, $aFilterSplit[$iCC], $sExclude) Case Not $iRecurse And $iFlag = 2; folders only , not recursed _FileListToArrayFolders($arFolders[$iCF], $sFileString, $aFilterSplit[$iCC], $iRecurse, $sExclude) EndSelect;$cw = ConsoleWrite("$iCC=" & $iCC & " $sFileString =" & @LF & $sFileString & @LF) If $iCF = 0 Then $sHoldSplit &= '|' & $aFilterSplit[$iCC]; $cw = ConsoleWrite("$iCC=" & $iCC & " $sFileString =" & @LF & $sFileString & @LF) Next If $iCF = 0 Then $sFilter = StringReplace(StringTrimLeft($sHoldSplit, 1), "**", "*");,$cw = ConsoleWrite("$iCC=" & $iCC & " $sFilter =" & @LF & $sFilter & @LF) Next If $iRecurse And $iFlag = 2 And $sFilter <> "*" And $sFilter <> "*.*" Then ; filter folders ------------------- $sFileString1 = StringTrimRight(StringReplace($sFileString1, "*", @CRLF), 1) $sFilter1 = StringReplace(StringReplace(StringReplace($sFilter1, ".", "\."), "*", ".*"), "?", ".");change the filters to RegExp filters Local $pattern = '(?m)(^(?i)' & $sFilter1 & '$)', $cw = ConsoleWrite("$sFilter =" & @LF & $sFilter1 & @LF), $cw = ConsoleWrite("$pattern =" & @LF & $pattern & @LF) Local $asList = StringRegExp($sFileString1, $pattern, 3) If (Not $iBaseDir) Then $sFileString1 = _ArrayToString($asList, "*") $sFileString1 = StringReplace($sFileString1, $sPath & "\", "", 0, 2) $asList = StringSplit($sFileString1, "*") EndIf ElseIf $iRecurse And $iFlag = 2 Then $sFileString = $sFileString1 EndIf;If UBound($asList) > 1 Then ConsoleWrite("$asList[1] =" & @LF & $asList[1] & @LF) ConsoleWrite("StringLen($sFileString)="&StringLen($sFileString)) If IsArray($asList) And UBound($asList) > 1 And $asList[0] <> "" Then Return $asList If (Not $iBaseDir) Or (Not $iRecurse And Not $iFlag And Not $iBaseDir) Then $sFileString = StringReplace($sFileString, $sPath & "\", "", 0, 2) $arReturn = StringSplit(StringTrimRight($sFileString, 1), "*");~ local $a=ConsoleWrite("$sFileString :"&@lf&StringReplace($sFileString,"|",@crlf)&@lf),$timerstamp1=TimerInit() If IsArray($arReturn) And UBound($arReturn) > 1 And $arReturn[1] <> "" And Not (UBound($aFilterSplit) = 3 And $aFilterSplit[2] == "") Then _deleteduplicate1($arReturn);and $arFolders[1]<>"" If $arReturn[1]="" Then SetError(4) Return $arReturn;~ Return StringSplit(StringTrimRight($sFileString, 1), "*") EndFunc ;==>_FileListToArray3 Func _deleteduplicate1(ByRef $ar_Array) Local $ar_New[1], $timerstamp1 = TimerInit(), $s_New _ArrayDelete($ar_Array, 0) ConsoleWrite("UBound($ar_Array) =" & UBound($ar_Array) & @LF) _ArraySort($ar_Array) Local $count = UBound($ar_Array) - 1, $a = ConsoleWrite("_ArraySort :" & Round(TimerDiff($timerstamp1)) & " mseconds " & @LF), $timerstamp1 = TimerInit() For $x = $count - 1 To 0 Step - 1 $Itemtxt1 = $ar_Array[ $x] Do If $x > 0 Then $Itemtxt2 = $ar_Array[ $x - 1] If StringUpper($Itemtxt1) == StringUpper($Itemtxt2) Then $count -= 1 $x -= 1 EndIf EndIf Until StringUpper($Itemtxt1) <> StringUpper($Itemtxt2) Or $x = 0 $s_New &= $Itemtxt1 & "|" Next $ar_Array = StringSplit($s_New, "|") Local $a = ConsoleWrite("_ArrayAdd :" & Round(TimerDiff($timerstamp1)) & " mseconds " & @LF), $timerstamp1 = TimerInit() If $ar_Array [UBound($ar_Array) - 1] == "" Then _ArrayDelete($ar_Array, UBound($ar_Array) - 1) _ArrayReverse($ar_Array, 1) If $ar_Array [UBound($ar_Array) - 1] == "" Then _ArrayDelete($ar_Array, UBound($ar_Array) - 1) ConsoleWrite("_ArrayReverse :" & Round(TimerDiff($timerstamp1)) & " mseconds " & @LF) Return 1 EndFunc ;==>_deleteduplicate1 Func _FileListToArrayFolders($sPathF, ByRef $sFileStringF, $sFilterF, $iRecurseF, $sExcludeF = "") Local $hSearch = FileFindFirstFile($sPathF & "\" & $sFilterF), $sPathF2 If $hSearch = -1 Then Return SetError(4, 4, "") If $sExcludeF == "" Then While 1 $sFileF = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf $sPathF2 = $sPathF & "\" & $sFileF If StringInStr(FileGetAttrib($sPathF2), "D") Then ;directories only wanted; and the attrib shows is directory $sFileStringF &= $sPathF2 & "*";this writes the filename to the delimited string with * as delimiter If $iRecurseF = 1 Then _FileListToArrayFolders($sPathF2, $sFileStringF, $sFilterF, $iRecurseF) EndIf WEnd Else While 1 $sFileF = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf $sPathF2 = $sPathF & "\" & $sFileF; if folders only and this pattern matches exclude pattern, no further list or subdir If StringRegExp($sPathF2, $sExcludeF) Then ContinueLoop If StringInStr(FileGetAttrib($sPathF2), "D") Then ;directories only wanted; and the attrib shows is directory $sFileStringF &= $sPathF2 & "*";this writes the filename to the delimited string with * as delimiter with * as delimiter If $iRecurseF = 1 Then _FileListToArrayFolders($sPathF2, $sFileStringF, $sFilterF, $iRecurseF, $sExcludeF) EndIf WEnd EndIf FileClose($hSearch) EndFunc ;==>_FileListToArrayFolders ;=============================================================================== ; ; Description: Helper func for _FileListToArray wrapper; lists all files and folders in a specified path ; Syntax: _FileListToArrayFiles($s_PathF, ByRef $s_FileStringF, $s_FilterF) ;quick as not recursive ; Parameter(s): $s_PathF = Path to generate filelist for ; $s_FileStringF = The string for lists all files and folders in a specified path ; $s_FilterF = The filter to use. Search the Autoit3 manual for the word "WildCards" For details ; $sExcludeF= The Exclude filter to use. "WildCards" For details ; Requirement(s): None ; Return Value(s): On Success - Returns an array containing the list of files and folders in the specified path ; On Failure - Returns the an empty string "" if no files are found and sets @Error on errors ; @Error=1 Path not found or invalid ; @Error=2 Invalid $s_Filter ; @Error=4 No File(s) Found ; ; Author(s): randallc; modified from SolidSnake, SmoKe_N, GEOsoft and big_daddy ;=============================================================================== Func _FileListToArrayFiles($sPathF, ByRef $sFileStringF, $sFilterF, $sExcludeF = "") Local $hSearch = FileFindFirstFile($sPathF & "\" & $sFilterF), $sPathF2 If $hSearch = -1 Then Return SetError(4, 4, "") If $sExcludeF == "" Then While 1 $sFileF = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf $sPathF2 = $sPathF & "\" & $sFileF;directories not wanted; and the attrib shows not directory If Not StringInStr(FileGetAttrib($sPathF2), "D") Then $sFileStringF &= $sPathF2 & "*";this writes the filename to the delimited string with * as delimiter WEnd Else While 1 $sFileF = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf $sPathF2 = $sPathF & "\" & $sFileF;directories not wanted; and the attrib shows not directory; and filename [only] does not match exclude If Not StringInStr(FileGetAttrib($sPathF2), "D") _ And Not StringRegExp($sFileF, $sExcludeF) Then $sFileStringF &= $sPathF2 & "*";this writes the filename to the delimited string with * as delimiter WEnd EndIf FileClose($hSearch) EndFunc ;==>_FileListToArrayFiles ;=============================================================================== ; ; Description: Helper self-calling func for _FileListToArray wrapper; lists all files and folders in a specified path ; Syntax: _FileListToArrayRecFiles($s_PathF, ByRef $s_FileStringF, $s_FilterF) ; recursive ; Parameter(s): $s_PathF = Path to generate filelist for ; $s_FileStringF = The string for lists all files and folders in a specified path ; $s_FilterF = The filter to use. Search the Autoit3 manual for the word "WildCards" For details ; $sExcludeF= The Exclude filter to use. "WildCards" For details ; Requirement(s): None ; Return Value(s): On Success - Returns an array containing the list of files and folders in the specified path ; On Failure - Returns the an empty string "" if no files are found and sets @Error on errors ; @Error=1 Path not found or invalid ; @Error=2 Invalid $s_Filter ; @Error=4 No File(s) Found ; ; Author(s): randallc; modified from SolidSnake, SmoKe_N, GEOsoft and big_daddy ;=============================================================================== Func _FileListToArrayRecAll($sPathF, ByRef $sFileStringF, $sFilterF, $sExcludeF = "") Local $hSearch = FileFindFirstFile($sPathF & "\" & $sFilterF), $sPathF2 If $hSearch = -1 Then Return SetError(4, 4, "") If $sExcludeF == "" Then While 1 $sFileF = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf $sPathF2 = $sPathF & "\" & $sFileF $sFileStringF &= $sPathF2 & "*";this writes the filename to the delimited string with * as delimiter If StringInStr(FileGetAttrib($sPathF2), "D") Then _FileListToArrayRecAll($sPathF2, $sFileStringF, $sFilterF);, $iFlagF, $iRecurseF) WEnd Else While 1 $sFileF = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf $sPathF2 = $sPathF & "\" & $sFileF If StringInStr(FileGetAttrib($sPathF2), "D") Then $sFileStringF &= $sPathF2 & "*";this writes the directoryname _FileListToArrayRecAll($sPathF2, $sFileStringF, $sFilterF, $sExcludeF);, $iFlagF, $iRecurseF) Else ;if not directory, check Exclude match If Not StringRegExp($sFileF, $sExcludeF) Then $sFileStringF &= $sPathF2 & "*";this writes the filename to the delimited string with * as delimiter EndIf WEnd EndIf FileClose($hSearch) EndFunc ;==>_FileListToArrayRecAll ;=============================================================================== ; ; Description: Helper self-calling func for _FileListToArray wrapper; lists all files in a specified path ; Syntax: _FileListToArrayRecFiles($s_PathF, ByRef $s_FileStringF, $s_FilterF) ; recursive ; Parameter(s): $s_PathF = Path to generate filelist for ; $s_FileStringF = The string for lists all files and folders in a specified path ; $s_FilterF = The filter to use. Search the Autoit3 manual for the word "WildCards" For details ; $sExcludeF= The Exclude filter to use. "WildCards" For details ; Requirement(s): None ; Return Value(s): On Success - Returns an array containing the list of files and folders in the specified path ; On Failure - Returns the an empty string "" if no files are found and sets @Error on errors ; @Error=1 Path not found or invalid ; @Error=2 Invalid $s_Filter ; @Error=4 No File(s) Found ; ; Author(s): randallc; modified from SolidSnake, SmoKe_N, GEOsoft and big_daddy ;=============================================================================== Func _FileListToArrayRecFiles($sPathF, ByRef $sFileStringF, $sFilterF, $sExcludeF = "") Local $hSearch = FileFindFirstFile($sPathF & "\" & $sFilterF), $sPathF2 If $hSearch = -1 Then Return SetError(4, 4, "") If $sExcludeF == "" Then While 1 $sFileF = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf $sPathF2 = $sPathF & "\" & $sFileF If StringInStr(FileGetAttrib($sPathF2), "D") Then _FileListToArrayRecFiles($sPathF2, $sFileStringF, $sFilterF);, $iFlagF, $iRecurseF) Else $sFileStringF &= $sPathF2 & "*";this writes the filename to the delimited string with * as delimiter EndIf WEnd Else While 1 $sFileF = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf $sPathF2 = $sPathF & "\" & $sFileF If StringInStr(FileGetAttrib($sPathF2), "D") Then _FileListToArrayRecFiles($sPathF2, $sFileStringF, $sFilterF, $sExcludeF);, $iFlagF, $iRecurseF) Else If Not StringRegExp($sFileF, $sExcludeF) Then $sFileStringF &= $sPathF2 & "*";this writes the filename to the delimited string with * as delimiter EndIf WEnd EndIf FileClose($hSearch) EndFunc ;==>_FileListToArrayRecFiles ;=============================================================================== ; ; Description: Helper func for _FileListToArray wrapper; lists all files ONLY in a specified path ; Syntax: _FileListToArrayBrief2($s_PathF, ByRef $s_FileStringF, $s_FilterF) ;quick as not recursive ; Parameter(s): $s_PathF = Path to generate filelist for ; $s_FileStringF = The string for lists all files and folders in a specified path ; $s_FilterF = The filter to use. Search the Autoit3 manual for the word "WildCards" For details ; $sExcludeF= The Exclude filter to use. "WildCards" For details ; Requirement(s): None ; Return Value(s): On Success - Returns an array containing the list of files and folders in the specified path ; On Failure - Returns the an empty string "" if no files are found and sets @Error on errors ; @Error=1 Path not found or invalid ; @Error=2 Invalid $s_Filter ; @Error=4 No File(s) Found ; ; Author(s): randallc; modified from SolidSnake, SmoKe_N, GEOsoft and big_daddy ;=============================================================================== Func _FileListToArrayBrief2($sPathF, ByRef $sFileStringF, $sFilterF, $sExcludeF = "") $hSearch = FileFindFirstFile($sPathF & "\" & $sFilterF) If $hSearch = -1 Then Return SetError(4, 4, "") If $sExcludeF == "" Then While 1 $sFileF = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf $sFileStringF &= $sFileF & "*";this writes the filename to the delimited string with * as delimiter; only time no full path included WEnd Else While 1 $sFileF = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf ;If not StringRegExp($sFileF,$sExcludeF) then $sFileStringF &= $sPathF2 & "*" If Not StringRegExp($sFileF, $sExcludeF) Then $sFileStringF &= $sFileF & "*";this writes the filename to the delimited string with * as delimiter; only time no full path included WEnd EndIf FileClose($hSearch) EndFunc ;==>_FileListToArrayBrief2 ;=============================================================================== ; ; Description: Helper func for _FileListToArray wrapper; lists all files and folders in a specified path ; Syntax: _FileListToArrayBrief1($s_PathF, ByRef $s_FileStringF, $s_FilterF) ;quick as not recursive ; Parameter(s): $s_PathF = Path to generate filelist for ; $s_FileStringF = The string for lists all files and folders in a specified path ; $s_FilterF = The filter to use. Search the Autoit3 manual for the word "WildCards" For details ; $sExcludeF= The Exclude filter to use. "WildCards" For details ; Requirement(s): None ; Return Value(s): On Success - Returns an array containing the list of files and folders in the specified path ; On Failure - Returns the an empty string "" if no files are found and sets @Error on errors ; @Error=1 Path not found or invalid ; @Error=2 Invalid $s_Filter ; @Error=4 No File(s) Found ; ; Author(s): randallc; modified from SolidSnake, SmoKe_N, GEOsoft and big_daddy ;=============================================================================== Func _FileListToArrayBrief1($sPathF, ByRef $sFileStringF, $sFilterF, $sExcludeF = "") $hSearch = FileFindFirstFile($sPathF & "\" & $sFilterF) If $hSearch = -1 Then Return SetError(4, 4, "") If $sExcludeF == "" Then While 1 $sFileF = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf $sFileStringF &= $sPathF & "\" & $sFileF & "*";this writes the filename to the delimited string with * as delimiter [remo] WEnd Else While 1 $sFileF = FileFindNextFile($hSearch) If @error Then SetError(0) ExitLoop EndIf If Not StringRegExp($sFileF, $sExcludeF) Then $sFileStringF &= $sPathF & "\" & $sFileF & "*";this writes the filename to the delimited string with * as delimiter [remo] WEnd EndIf FileClose($hSearch) EndFunc ;==>_FileListToArrayBrief1