Shirotaiku |
|
| Ciao, praticamente vai ad usare FileFindFirstFile(Dir), che ti da il nome del primo file in quella cartella , ed usi FileFindNextFile(HandleFileFindFirstFile) per spostarti e trovare il 2 / 3 / ecc.. file. Ti lascio un udf che uso praticamente sempre. Devi usare _Search_File(NomeDir) e ti ritorna un array ove lo $array[0] č uguale al numero di elementi dello stesso, il secondo parametro riguarda l'estenzione Es. Tutti i file *.* solo file rar *.rar e cosi via. CODICE #cs ----------------------------------------------------------------------------
AutoIt Version: 3.3.14.2 Author: Shirotaiku
#ce ---------------------------------------------------------------------------- #include-once
#cs $Dir=@ScriptDir $file=_Search_File($Dir,"*.*") for $a=1 to $file[0] Msgbox(64,"Posizione "&$a,"Nome File"&$file[$a]) next exit #ce
Func _Search_File($Directory,$Type) $hSearch=FileFindFirstFile(FixDir($Directory)&$Type) If $hSearch = -1 Then Return SetError(1,0,"Nessun file trovato!!") Dim $hFindFile[2] $move=1 While 1 $hFindFile[$move]=FileFindNextFile($hSearch) If @error Then ExitLoop If @extended=0 Then ReDim $hFindFile[UBound($hFindFile)+1] $move+=1 EndIf WEnd ReDim $hFindFile[UBound($hFindFile)-1] $hFindFile[0]=$move-1 Return $hFindFile EndFunc
Func _Search_Dir($Directory) $hSearch=FileFindFirstFile(FixDir($Directory)&"*.*") If $hSearch = -1 Then Return SetError(1,0,"Nessuna Directory trovata!!") Dim $hFindFile[2] $move=1 While 1 $hFindFile[$move]=FileFindNextFile($hSearch) If @error Then ExitLoop If @extended=1 Then ReDim $hFindFile[UBound($hFindFile)+1] $move+=1 EndIf WEnd ReDim $hFindFile[UBound($hFindFile)-1] $hFindFile[0]=$move-1 Return $hFindFile EndFunc
Func FixDir($Directory) $Predir = StringRight($Directory, 1) If $Predir = "\" Or $Predir = "/" Then Return $Directory Else Return $Directory & '\' EndIf EndFunc ;==>FixDir
|
| |