编辑config.ini的内容为:
[MacIp]
00:E0:A0:1D:68:DE=053
;事先准备的MAC和机器编号对应表
上面的00:E0:A0:1D:68:DE 是我用的本机MAC
然后用AU3 获取本机MAC 然后到config.ini里查找相应的机器编号$mymac=mac()
MsgBox(0,"你的mac地址: ",$mymac )
$number = IniRead ("config.ini","MacIp",$mymac, 0)
MsgBox(0,"本机机器编号为:",$number )
Func mac()
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Output=""
$objWMIService = ObjGet("winmgmts:\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled != 0", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
$Output1 = $Output & "" & $objItem.MACAddress & @CRLF
Next
Return $Output1
Else
Endif
EndFunc
第一个MsgBox 能显示出我的MAC (00:E0:A0:1D:68:DE)
但是第二个MsgBox 显示的机器编号是 “0”呢? 百思不得其解 |