请大家帮忙将一小段VBS脚本转换为AU3脚本
此段VBS脚本作用是获取DELL电脑的 服务编号及快速服务代码想转换为一个func,返回 $TAG $Code两个值,如果错误,两个值均设为 errorstrComputer = "."Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48)
For Each objItem in colItems
strTAG = objItem.SerialNumber
Next
strTAG = UCase(strTAG)
TAGLen = Len(strTAG)
tmp = 0
For i = 1 To TAGLen
ChrSerial = Asc(Mid(strTAG,i,1))
If ChrSerial > 47 And ChrSerial < 58 Then '是数字
ChrSerial = ChrSerial - 48
ElseIf ChrSerial > 64 And ChrSerial < 91 Then '是字母
ChrSerial = ChrSerial - 55
Else
WScript.Echo "The Service TAG is error"
WScript.Quit
End If
tmp = tmp + 36 ^ (TAGLen - i) * ChrSerial
Next
WScript.Echo "Service TAG: " & strTAG
WScript.Echo "Express Service Code: " & tmp 不懂VBS,仅瞎猜
#include <array.au3>
Local $colItems = ""
Local $strComputer = "localhost"
Local $Output = ""
Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", 0x10 + 0x20)
If IsObj($colItems) Then
For $objItem In $colItems
$Output = $objItem.SerialNumber
Next
EndIf
Local $tmp = 0
Local $ChrSerial = 0
$strTag = StringToASCIIArray($Output)
For $i = 0 To UBound($strTag) - 1
$ChrSerial = $strTag[$i]
If $ChrSerial > 47 And $ChrSerial < 58 Then
$ChrSerial -= 48
ElseIf $ChrSerial > 64 And $ChrSerial < 91 Then
$ChrSerial -= 55
Else
ExitLoop
EndIf
$tmp = $tmp + 36 ^ (UBound($strTag) - $i - 1) * $ChrSerial
Next
MsgBox(0, 0, "Service TAG: " & $strTag & @CRLF & "Express Service Code: " & $tmp)
本帖最后由 elexy 于 2011-9-27 11:54 编辑
Service TAG: 显示不出来,不知道何故???
Code可正常显示 改输出变量 MsgBox(0, 0, "Service TAG: " & $Output)能正常,不知道代码哪有问题???请高手解答一下。
页:
[1]