参加讨论------#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
Example()
Func Example()
; 使用默认参数返回 desktop(桌面) 目录所有文件和文件夹清单.
Local $aFiles = _FileListToArray(@ScriptDir, '*.*', 1, True)
If @error = 1 Then
MsgBox($MB_SYSTEMMODAL, "", "路径无效.")
Exit
EndIf
If @error = 4 Then
MsgBox($MB_SYSTEMMODAL, "", "未发现文件.")
Exit
EndIf
Local $imgfile1, $aPA, $iSL
$sExt = "jpg|ini|exe|txt|au3|xlsx|xls|rar"
If Not @error Then
Dim $aPic[UBound($aFiles)], $iSL = 0
For $ii = 1 To UBound($aFiles) - 1
If StringRegExp($aFiles[$ii], '(?i)\.(?:' & $sExt & ")$") Then
$aPic[$iSL] = $aFiles[$ii]
$iSL += 1
;数组
Local $aArray_2D[$iSL]
For $i = 0 To UBound($aArray_2D) - 1
$aArray_2D[$i] = $aPic[$i]
Next
EndIf
Next
EndIf
_ArrayDisplay($aArray_2D, "显示")
EndFunc ;==>Example
|