#include <Array.au3>
_Main()
Exit
Func _Main()
Local $r
Local $EveRptFile
$r=_CreateEverestReport()
If $r==-1 Then
MsgBox(0+16,"错误","Everest文件包存在问题!")
Return
ElseIf $r==0 Then
MsgBox(0+16,"错误","Everest检测报告生成失败!")
Return
Else
$EveRptFile=$r
EndIf
;$EveRptFile=@ScriptDir&"\Everest\Reports\Report.ini"
Local $EveRpt
$EveRpt=_ReadEverestReport($EveRptFile)
_ArrayDisplay($EveRpt)
Local $HdwType
$HdwType=_EveRptToHdwType($EveRpt)
_ArrayDisplay($HdwType)
$HdwType=_Tidy($HdwType)
_ArrayDisplay($HdwType)
EndFunc
Func _CreateEverestReport()
;设定Everest文件包所在位置
Local $EveDir=@ScriptDir&"\Everest"
;Local $Cmd = @ComSpec & " /c " & '"' & _
;@ScriptDir & "\Everest\Everest.exe" & _
;" /r /custom user.rpf /ini report.ini /silent" & '"'
;检测并确认所有必须的文件都存在
If Not(FileExists($EveDir)) Then Return -1
If Not(FileExists($EveDir&"\everest.dat")) Then Return -1
If Not(FileExists($EveDir&"\everest.exe")) Then Return -1
If Not(FileExists($EveDir&"\everest.exe.manifest")) Then Return -1
If Not(FileExists($EveDir&"\everest.mem")) Then Return -1
If Not(FileExists($EveDir&"\kerneld.amd64")) Then Return -1
If Not(FileExists($EveDir&"\kerneld.ia64")) Then Return -1
If Not(FileExists($EveDir&"\kerneld.w9x")) Then Return -1
If Not(FileExists($EveDir&"\kerneld.wnt")) Then Return -1
If Not(FileExists($EveDir&"\pkey.txt")) Then Return -1
If Not(FileExists($EveDir&"\User.rpf")) Then Return -1
;扫描硬件
TrayTip("硬件扫描","正在扫描硬件...","",1)
RunWait($EveDir&"\everest.exe"&" /r /custom user.rpf /ini report.ini /silent", $EveDir, @SW_HIDE)
TrayTip("","","")
;检查硬件检测报告是否生成成功
If FileExists($EveDir&"\Reports\Report.ini") Then
Return $EveDir&"\Reports\Report.ini"
Else
Return 0
EndIf
EndFunc
Func _ReadEverestReport($EveRptFile)
Local $EveRpt[7][21]
;读CPU数据
Local $CPU
$CPU=IniRead($EveRptFile,"CPU","CPU Properties|CPU Type","")
$EveRpt[1][1]=$CPU
$EveRpt[1][0]=1
;读Chipset数据
Local $i=1,$p=1
While 1
Local $NorthBridge,$SouthBridge
$NorthBridge=IniRead($EveRptFile,"Chipset","Chipset"&$i&"|North Bridge Properties|North Bridge","")
$SouthBridge=IniRead($EveRptFile,"Chipset","Chipset"&$i&"|South Bridge Properties|South Bridge","")
If $NorthBridge="" And $SouthBridge="" Then
ExitLoop
Else
If $p>=UBound($EveRpt,2) Then
ExitLoop
Else
If $NorthBridge<>"" Then
$EveRpt[2][$p]=$NorthBridge
$p+=1
EndIf
If $SouthBridge<>"" Then
$EveRpt[2][$p]=$SouthBridge
$p+=1
EndIf
EndIf
EndIf
$i+=1
WEnd
$EveRpt[2][0]=$p-1
;读Video数据
Local $i=1,$p=1
While 1
Local $Video
$Video=IniRead($EveRptFile,"PCI / AGP Video","PCI / AGP Video"&$i,"")
If $Video="" Then
ExitLoop
Else
If $p>=UBound($EveRpt,2) Then
ExitLoop
Else
$EveRpt[3][$p]=$Video
$p+=1
EndIf
EndIf
$i+=1
WEnd
$EveRpt[3][0]=$p-1
;读GPU数据
Local $i=1,$p=1
While 1
Local $GPU
$GPU=IniRead($EveRptFile,"GPU","GPU"&$i&"|Graphics Processor Properties|Video Adapter","")
If $GPU="" Then
ExitLoop
Else
If $p>=UBound($EveRpt,2) Then
ExitLoop
Else
$EveRpt[4][$p]=$GPU
$p+=1
EndIf
EndIf
$i+=1
WEnd
$EveRpt[4][0]=$p-1
;读Audio数据
Local $i=1,$p=1
While 1
Local $Audio
$Audio=IniRead($EveRptFile,"PCI / PnP Audio","PCI / PnP Audio"&$i,"")
If $Audio="" Then
ExitLoop
Else
If $p>=UBound($EveRpt,2) Then
ExitLoop
Else
Local $Loc=StringInStr($Audio,"@")
If $Loc>0 Then
$Audio=StringTrimRight($Audio,StringLen($Audio)-$Loc+1)
EndIf
$EveRpt[5][$p]=$Audio
$p+=1
EndIf
EndIf
$i+=1
WEnd
$EveRpt[5][0]=$p-1
;读Network数据
Local $i=1,$p=1
While 1
Local $Network
$Network=IniRead($EveRptFile,"PCI / PnP Network","PCI / PnP Network"&$i,"")
If $Network="" Then
ExitLoop
Else
If $p>=UBound($EveRpt,2) Then
ExitLoop
Else
$EveRpt[6][$p]=$Network
$p+=1
EndIf
EndIf
$i+=1
WEnd
$EveRpt[6][0]=$p-1
;简化数组元素
Local $Max=$EveRpt[1][0]
Local $i
For $i=2 To UBound($EveRpt,1)-1
If $EveRpt[$i][0]>$Max Then
$Max=$EveRpt[$i][0]
EndIf
Next
ReDim $EveRpt[7][$Max+1]
Return $EveRpt
EndFunc
Func _EveRptToHdwType($EveRpt)
Local $HdwType[UBound($EveRpt,1)][UBound($EveRpt,2)]
Local $i
For $i=1 To UBound($EveRpt,1)-1
$HdwType[$i][0]=$EveRpt[$i][0]
Next
;CPU信息转硬件类型
Select
Case StringInStr($EveRpt[1][1],"AMD")
$HdwType[1][1]="AMD"
Case StringInStr($EveRpt[1][1],"Intel")
$HdwType[1][1]="Intel"
EndSelect
;主板芯片信息转硬件类型
Local $j
For $j=1 To $EveRpt[2][0]
Select
Case StringInStr($EveRpt[2][$j],"ALI") Or StringInStr($EveRpt[2][$j],"ULI")
$HdwType[2][$j]="ALI_ULI"
Case StringInStr($EveRpt[2][$j],"AMD") Or StringInStr($EveRpt[2][$j],"ATI")
$HdwType[2][$j]="AMD_ATI"
Case StringInStr($EveRpt[2][$j],"INTEL")
$HdwType[2][$j]="INTEL"
Case StringInStr($EveRpt[2][$j],"NVIDIA")
$HdwType[2][$j]="NVIDIA"
Case StringInStr($EveRpt[2][$j],"SIS")
$HdwType[2][$j]="SIS"
Case StringInStr($EveRpt[2][$j],"VIA")
$HdwType[2][$j]="VIA"
Case Else
$HdwType[2][$j]="Other"
EndSelect
Next
;显卡信息转硬件类型
Local $j
For $j=1 To $EveRpt[3][0]
Select
Case StringInStr($EveRpt[3][$j],"AMD") Or StringInStr($EveRpt[3][$j],"ATI")
$HdwType[3][$j]="AMD_ATI"
Case StringInStr($EveRpt[3][$j],"INTEL")
$HdwType[3][$j]="INTEL"
Case StringInStr($EveRpt[3][$j],"Matrox")
$HdwType[3][$j]="Matrox"
Case StringInStr($EveRpt[3][$j],"NVIDIA")
$HdwType[3][$j]="NVIDIA"
Case StringInStr($EveRpt[3][$j],"SIS")
$HdwType[3][$j]="SIS"
Case StringInStr($EveRpt[3][$j],"VIA") Or StringInStr($EveRpt[3][$j],"S3")
$HdwType[3][$j]="VIA_S3"
Case StringInStr($EveRpt[3][$j],"VMWARE")
$HdwType[3][$j]="VMWARE"
Case Else
$HdwType[3][$j]="Other"
EndSelect
Next
;GPU信息转硬件类型
Local $j
For $j=1 To $EveRpt[4][0]
Select
Case StringInStr($EveRpt[4][$j],"AMD") Or _
StringInStr($EveRpt[4][$j],"ATI") Or _
StringInStr($EveRpt[4][$j],"Radeon")
$HdwType[4][$j]="AMD_ATI"
Case StringInStr($EveRpt[4][$j],"INTEL")
$HdwType[4][$j]="INTEL"
Case StringInStr($EveRpt[4][$j],"Matrox")
$HdwType[4][$j]="Matrox"
Case StringInStr($EveRpt[4][$j],"NVIDIA") Or _
StringInStr($EveRpt[4][$j],"Geforce")
$HdwType[4][$j]="NVIDIA"
Case StringInStr($EveRpt[4][$j],"SIS")
$HdwType[4][$j]="SIS"
Case StringInStr($EveRpt[4][$j],"VIA") Or StringInStr($EveRpt[4][$j],"S3")
$HdwType[4][$j]="VIA_S3"
Case StringInStr($EveRpt[4][$j],"VMWARE")
$HdwType[4][$j]="VMWARE"
Case Else
$HdwType[4][$j]="Other"
EndSelect
Next
;声卡信息转硬件类型
Local $j
For $j=1 To $EveRpt[5][0]
Select
Case StringInStr($EveRpt[5][$j],"Analog Devices")
$HdwType[5][$j]="ADI"
Case StringInStr($EveRpt[5][$j],"ATI") Or StringInStr($EveRpt[5][$j],"ATI")
$HdwType[5][$j]="AMD_ATI"
Case StringInStr($EveRpt[5][$j],"C-Media")
$HdwType[5][$j]="C-Media"
Case StringInStr($EveRpt[5][$j],"Conexant")
$HdwType[5][$j]="Conexant"
Case StringInStr($EveRpt[5][$j],"Creative")
$HdwType[5][$j]="Creative"
Case StringInStr($EveRpt[5][$j],"IDT") Or StringInStr($EveRpt[5][$j],"Sigmatel")
$HdwType[5][$j]="Sigmatel"
Case StringInStr($EveRpt[5][$j],"Realtek")
$HdwType[5][$j]="Realtek"
Case StringInStr($EveRpt[5][$j],"SIS")
$HdwType[5][$j]="SIS"
Case StringInStr($EveRpt[5][$j],"VIA")
$HdwType[5][$j]="VIA"
Case Else
$HdwType[5][$j]="Other"
EndSelect
Next
;网卡信息转硬件类型
Local $j
For $j=1 To $EveRpt[6][0]
Select
Case StringInStr($EveRpt[6][$j],"3Com")
$HdwType[6][$j]="3Com"
Case StringInStr($EveRpt[6][$j],"AMD")
$HdwType[6][$j]="AMD"
Case StringInStr($EveRpt[6][$j],"Broadcom")
$HdwType[6][$j]="Broadcom"
Case StringInStr($EveRpt[6][$j],"D-Link")
$HdwType[6][$j]="D-Link"
Case StringInStr($EveRpt[6][$j],"Intel")
$HdwType[6][$j]="Intel"
Case StringInStr($EveRpt[6][$j],"Marvell")
$HdwType[6][$j]="Marvell"
Case StringInStr($EveRpt[6][$j],"nVIDIA")
$HdwType[6][$j]="nVIDIA"
Case StringInStr($EveRpt[6][$j],"Realtek")
$HdwType[6][$j]="Realtek"
Case StringInStr($EveRpt[6][$j],"SiS")
$HdwType[6][$j]="SiS"
Case StringInStr($EveRpt[6][$j],"TP-Link")
$HdwType[6][$j]="TP-Link"
Case StringInStr($EveRpt[6][$j],"ULI")
$HdwType[6][$j]="ULI"
Case StringInStr($EveRpt[6][$j],"VIA")
$HdwType[6][$j]="VIA"
Case Else
$HdwType[6][$j]="Other"
EndSelect
Next
Return $HdwType
EndFunc
Func _Tidy($HdwType)
;将相同的类型去掉
Local $i,$j,$k
For $i=1 To UBound($HdwType,1)-1
For $j=1 To UBound($HdwType,2)-2
For $k=$j+1 To UBound($HdwType,2)-1
If $HdwType[$i][$j]=$HdwType[$i][$k] Then
$HdwType[$i][$k]=""
EndIf
Next
Next
Next
;整理数组
Local $tHdwType[UBound($HdwType,1)][UBound($HdwType,2)]
Local $i
For $i=1 To UBound($HdwType,1)-1
Local $p=1
For $j=1 To UBound($HdwType,2)-1
If $HdwType[$i][$j]<>"" Then
$tHdwType[$i][$p]=$HdwType[$i][$j]
$p+=1
EndIf
Next
$tHdwType[$i][0]=$p-1
Next
;简化数组元素
Local $Max=$tHdwType[1][0]
Local $i
For $i=2 To UBound($tHdwType,1)-1
If $tHdwType[$i][0]>$Max Then
$Max=$tHdwType[$i][0]
EndIf
Next
ReDim $tHdwType[UBound($HdwType,1)][$Max+1]
Return $tHdwType
EndFunc
文件在WIN7桌面的情况下生成的reports不在Everest中,而是在我的文档中,而在D盘或者E盘就可以用了,我搜索了半天也没有解决的办法,希望大家给点意见,在论坛上关于此类问题我也看了,好像没有什么不对的地方。我想因该是@ScriptDir的问题,具体问题还是不知道。难道是我系统的环境变量的问题吗?