I found itemindex property using this:
w=GetObject("winmgmts:")
objCPUItem =w=>InstancesOf("Win32_Processor")
cc=param(objCPUItem)
ec=each(cc)
while ec {
Print eval$(ec) ' print every function/property of object x
}
Sub QueryInterface(in riid *GUID, out ppvObj **void)
Function AddRef as ULONG
Function Release as ULONG
Sub GetTypeInfoCount(out pctinfo *UINT)
Sub GetTypeInfo(in itinfo UINT, in lcid ULONG, out pptinfo **void)
Sub GetIDsOfNames(in riid *GUID, in rgszNames **char, in cNames UINT, in lcid ULONG, out rgdispid *Long)
Sub Invoke(in dispidMember Long, in riid *GUID, in lcid ULONG, in wFlags USHORT, in pdispparams *DISPPARAMS, out pvarResult *VARIANT, out pexcepinfo *EXCEPINFO, out puArgErr *UINT)
Property Get _NewEnum as IUnknown*
Function Item(in strObjectPath String, [in iFlags Long]) as *ISWbemObject
Property Get Count as Long
Property Get Security_ as *ISWbemSecurity
Function ItemIndex(in lIndex Long) as *ISWbemObject
This is the program (paste in an empty module)
rem {
[Dynamic, Provider("CIMWin32"), UUID("{8502C4BB-5FBB-11D2-AAC1-006008C78BC7}"), AMENDMENT]
class Win32_Processor : CIM_Processor
{
uint16 AddressWidth;
uint16 Architecture;
string AssetTag;
uint16 Availability;
string Caption;
uint32 Characteristics;
uint32 ConfigManagerErrorCode;
boolean ConfigManagerUserConfig;
uint16 CpuStatus;
string CreationClassName;
uint32 CurrentClockSpeed;
uint16 CurrentVoltage;
uint16 DataWidth;
string Description;
string DeviceID;
boolean ErrorCleared;
string ErrorDescription;
uint32 ExtClock;
uint16 Family;
datetime InstallDate;
uint32 L2CacheSize;
uint32 L2CacheSpeed;
uint32 L3CacheSize;
uint32 L3CacheSpeed;
uint32 LastErrorCode;
uint16 Level;
uint16 LoadPercentage;
string Manufacturer;
uint32 MaxClockSpeed;
string Name;
uint32 NumberOfCores;
uint32 NumberOfEnabledCore;
uint32 NumberOfLogicalProcessors;
string OtherFamilyDescription;
string PartNumber;
string PNPDeviceID;
uint16 PowerManagementCapabilities[];
boolean PowerManagementSupported;
string ProcessorId;
uint16 ProcessorType;
uint16 Revision;
string Role;
boolean SecondLevelAddressTranslationExtensions;
string SerialNumber;
string SocketDesignation;
string Status;
uint16 StatusInfo;
string Stepping;
string SystemCreationClassName;
string SystemName;
uint32 ThreadCount;
string UniqueId;
uint16 UpgradeMethod;
string Version;
boolean VirtualizationFirmwareEnabled;
boolean VMMonitorModeExtensions;
uint32 VoltageCaps;
};
}
// declare w "winmgmts:" ' or alternative use GetObject()
w=GetObject("winmgmts:") ' some objects use this GetObject("", "M2000.x86") like assembler
objCPUItem =w=>InstancesOf("Win32_Processor")
for i=0 to objCPUItem=>count-1
Print "CPU#"+(i+1)
objCPU=objCPUItem=>itemindex(i)
? "Description: "; objCPU=>Name, objCPU=>CreationClassName
? "CpuStatus: "; check(objCPU=>CpuStatus)
? "ProcessorType: "; check(objCPU=>ProcessorType)
? "NumberOfCores: "; objCPU=>NumberOfCores
? "NumberOfLogicalProcessors: "; objCPU=>NumberOfLogicalProcessors
? "LoadPercentage: ";str$(objCPU=>LoadPercentage,"#0.0");"%"
? "Frequency (MHz): ";objCPU=>MaxClockSpeed
? "SocketDesignation: "; objCPU=>SocketDesignation
? "CPU-ID: "; objCPU=>ProcessorId
? "SerialNumber (PartNumber): "; objCPU=>SerialNumber;" ("+objCPU=>PartNumber+")"
? "UniqueId: "; check(objCPU=>UniqueId)
? "Status: "; check(objCPU=>Status)
? "VoltageCaps: "; check(objCPU=>VoltageCaps)
? "InstallDate: "; check(objCPU=>InstallDate)
? "L2CacheSize: "; check(objCPU=>L2CacheSize)
? "L2CacheSpeed: "; check(objCPU=>L2CacheSpeed)
? "L3CacheSize: "; check(objCPU=>L3CacheSize)
? "L3CacheSpeed: "; check(objCPU=>L3CacheSpeed)
? "PNPDeviceID: "; check(objCPU=>PNPDeviceID)
next
function check(a)
if type(a)="Null" then
="Null"
else
=a
end if
end function
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου
You can feel free to write any suggestion, or idea on the subject.