Skip to content

Commit

Permalink
#56
Browse files Browse the repository at this point in the history
Attempt to fix #56
  • Loading branch information
rcmaehl committed Jun 28, 2021
1 parent 04e658e commit 16c5585
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions includes/_WMIC.au3
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
Func _GetCPUInfo($iFlag = 0)
Local Static $sCores
Local Static $sThreads
Local Static $sName
Local Static $vName
Local Static $sSpeed
Local Static $sArch
Local Static $sCPUs

If Not $sName <> "" Then
If Not $vName <> "" Then
Local $Obj_WMIService = ObjGet('winmgmts:\\' & @ComputerName & '\root\cimv2');
If (IsObj($Obj_WMIService)) And (Not @error) Then
Local $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_Processor')
Expand All @@ -19,7 +19,7 @@ Func _GetCPUInfo($iFlag = 0)
For $Obj_Item In $Col_Items
$sCores = $Obj_Item.NumberOfCores
$sThreads = $Obj_Item.NumberOfLogicalProcessors
$sName = $obj_Item.Name
$vName = $obj_Item.Name
$sSpeed = $Obj_Item.MaxClockSpeed
$sArch = $Obj_Item.AddressWidth
Next
Expand All @@ -35,15 +35,20 @@ Func _GetCPUInfo($iFlag = 0)
Return 0
EndIf
EndIf
If StringInStr($vName, "@") Then
$vName = StringSplit($vName, "@", $STR_NOCOUNT)
$sSpeed = StringRegExpReplace($vName[1], "[^[:digit:]]", "") & "0"
$vName = $vName[0]
EndIf
Switch $iFlag
Case 0
Return String($sCores)
Case 1
Return String($sThreads)
Case 2
Return StringStripWS(String($sName), $STR_STRIPTRAILING)
Return StringStripWS(String($vName), $STR_STRIPTRAILING)
Case 3
Return String($sSpeed)
Return Number($sSpeed)
Case 4
Return Number($sArch)
Case Else
Expand Down

0 comments on commit 16c5585

Please sign in to comment.