本帖最后由 zhouhaijin 于 2015-1-7 00:06 编辑
#include <File.au3>
#include <Array.au3>
While 1
$FileListA = _FileListToArray(@DesktopDir, "*.PDF")
_ArrayDelete($FileListA, 0)
Sleep(1000)
$FileListB = _FileListToArray(@DesktopDir, "*.PDF")
_ArrayDelete($FileListB, 0)
$aC = ArrayFindDifEle($FileListA, $FileListB)
If $aC[0] > 0 Then _ArrayDisplay($aC, "添加了新PDF文件")
WEnd
Func ArrayFindDifEle(ByRef $aA, ByRef $aB)
Local $aRetn[1] = [0]
If Not IsArray($aA) Or Not IsArray($aB) Then Return $aRetn
For $a In $aA
Assign('_' & String(StringToBinary(StringUpper($a))), 0, 1)
Next
Local $Num = 0
For $b In $aB
If Not IsDeclared('_' & String(StringToBinary(StringUpper($b)))) Then
$Num += 1
ReDim $aRetn[$Num + 1]
$aRetn[$Num] = $b
EndIf
Next
$aRetn[0] = $Num
Return $aRetn
EndFunc ;==>ArrayFindDifEle
|