This is a multi-part message in MIME format.
------=_NextPart_000_0026_01C52707.3F3947A0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Hi,
How to I format the output of a number in VBS, eg:
if the output is 1794, I want it to be 1790
if the output is 1795, I want it to be 1800
I was looking at FormatNumber and Round function, but neither seem to do =
what I want.
Here is the script to query CPU speed:
Set objWMIService =3D GetObject("winmgmts:" & =
"{impersonationLevel=3Dimpersonate}!\\" _
& strComputer & "\root\cimv2")
Set colProcessors =3D objWMIService.ExecQuery("SELECT * FROM =
Win32_Processor", "WQL", _
wbemFlagReturnImmediately + =
wbemFlagForwardOnly)
For Each objProcessor In colProcessors
strProcessorName =3D objProcessor.Name
strCurrentClockSpeed =3D objProcessor.CurrentClockSpeed
Next
Wscript.Echo "CPU speed: " & strCurrentClockSpeed & "Mhz"
Thanks
Frank
------=_NextPart_000_0026_01C52707.3F3947A0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1491" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>How to I format the output of a number =
in VBS,=20
eg:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>if the output is 1794, I want it to be=20
1790</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>if the output is 1795, I want it to be=20
1800</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>I was looking at FormatNumber and Round function, but neither seem =
to do=20
what I want.</DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Here is the script to query CPU =
speed:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> Set objWMIService =3D =
GetObject("winmgmts:"=20
& "{impersonationLevel=3Dimpersonate}!\\" _<BR> =20
&=
nbsp; =20
& strComputer & "\root\cimv2")</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> Set colProcessors =3D=20
objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL",=20
_<BR> &n=
bsp; &nb=
sp; &nbs=
p; =20
wbemFlagReturnImmediately + wbemFlagForwardOnly)<BR> For Each =
objProcessor=20
In colProcessors<BR> strProcessorName =3D=20
objProcessor.Name<BR> strCurrentClockSpeed =3D=20
objProcessor.CurrentClockSpeed<BR> Next<BR></FONT></DIV>
<DIV><FONT face=3DArial size=3D2> Wscript.Echo "CPU speed: " &=20
strCurrentClockSpeed & "Mhz"</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Thanks</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Frank</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> </DIV></FONT></BODY></HTML>
------=_NextPart_000_0026_01C52707.3F3947A0--