看似字符串,其实不是。
#include <File.au3>
$path = @UserProfileDir & "\Local Settings\Temporary Internet Files"
$search = findfile($path)
Func findfile($path)
$aFileList = _FileListToArray($path)
If Not @error Then
For $i = 1 To $aFileList[0]
findfile($path & '\' & $aFileList[$i])
If StringRight($path & '\' & $aFileList[$i], 4) = '.mp3' Then
$mp3info = _GetMp3info($path & '\' & $aFileList[$i])
;~ If IsArray($mp3info) Then MsgBox(0,0,String($mp3info[1])&string($mp3info[0]))
If Not @error Then
$mp3people = StringRegExpReplace(String($mp3info[1]), '\s+', '')
$mp3name = StringRegExpReplace(String($mp3info[0]), '\s+', '')
;FileMove($path & '\' & $aFileList[$i], "D:\123\" & $mp3people & "-" & $mp3name & ".mp3", 9)
FileCopy($path & '\' & $aFileList[$i], "D:\123\" & $mp3people & "-" & $mp3name & ".mp3", 9)
Else
;FileMove($path & '\' & $aFileList[$i], "D:\123\", 9)
FileCopy($path & '\' & $aFileList[$i], "D:\123\", 9)
EndIf
EndIf
Next
EndIf
EndFunc ;==>findfile
Func _GetMp3info($nFile)
$hFile = FileOpen($nFile, 0)
If $hFile = -1 Then
SetError(1)
Return ""
Else
FileSetPos($hFile, -128, 2)
$bBuffer = FileRead($hFile, 128)
If BinaryToString(BinaryMid($bBuffer, 1, 3)) = "TAG" Then
Local $TMPARRAY[4]
$TMPARRAY[0] = BinaryToString(BinaryMid($bBuffer, 4, 30))
$TMPARRAY[1] = BinaryToString(BinaryMid($bBuffer, 34, 30))
$TMPARRAY[2] = BinaryToString(BinaryMid($bBuffer, 64, 30))
$TMPARRAY[3] = BinaryToString(BinaryMid($bBuffer, 94, 4))
Return $TMPARRAY
Else
SetError(2)
Return ""
EndIf
EndIf
FileClose($hFile)
EndFunc ;==>_GetMp3info
|