; Just type /pc to get some infos about your PC
; Works without any kind of DLL
; Requires $unix.dur alias to display the uptime.
dialog pc {
title "Your PC information (v2 without moo.dll ;))"
option -dbu
size -1 -1 370 450
edit "",1,0 0 370 450,multi read autovs vsbar
}
alias pc {
if ($isid) { return }
if (!$len($1)) {
if (!$dialog(pc)) { dialog -m pc pc }
!did -r pc 1
!var %what = Name,CSDVersion,Version
if ($qu(SELECT %what FROM Win32_OperatingSystem)) {
!var %n = 1
while ($WR(%n).Name) {
!var %Name = $WR(%n).Name
!var %CSDVersion = $WR(%n).CSDVersion
!var %Version = $WR(%n).Version
al Operating System: $al(2) $gettok(%Name,1,124) %CSDVersion ( $+ %Version $+ )
al - Uptime: $al(3) $unix.dur($uptime(system,3))
!inc %n
}
al
}
%what = Architecture,Name,CurrentClockSpeed,LoadPercentage,NumberOfCores,NumberOfLogicalProcessors
if ($qu(SELECT %what FROM Win32_Processor)) {
!var %n = 1
while ($WR(%n).Name) {
!var %Architecture = $WR(%n).Architecture
!var %Name = $WR(%n).Name
!var %CurrentClockSpeed = $WR(%n).CurrentClockSpeed
!var %LoadPercentage = $WR(%n).LoadPercentage
!var %NumberOfCores = $WR(%n).NumberOfCores
!var %NumberOfLogicalProcessors = $WR(%n).NumberOfLogicalProcessors
al Processor $chr(35) $+ %n $+ / $+ $WG(Win32_ComputerSystem).NumberOfProcessors $+ : $al(2) %Name ( $+ $gettok($wildtok(0:x861:MIPS2:Alpha3:PowerPC6:Intel Itanium Processor Family (IPF)9:x64,%Architecture $+ :*,1,1),2,58) $+ )
al - Load: $al(3) %LoadPercentage $+ % ( $+ $int($calc(%CurrentClockSpeed / 100 * %LoadPercentage)) $+ Mhz in use of %CurrentClockSpeed $+ MHz $+ )
if (%NumberOfCores > 1 || %NumberOfLogicalProcessors > 1) {
al - Cores: $al(3) %NumberOfCores
al - Logical Processors: $al %NumberOfLogicalProcessors
}
!inc %n
}
al
}
%what = TotalVisibleMemorySize,FreePhysicalMemory
if ($qu(SELECT %what FROM CIM_OperatingSystem)) {
!var %n = 1
while ($WR(%n).TotalVisibleMemorySize) {
!var %FreePhysicalMemory = $bytes($calc($WR(%n).FreePhysicalMemory * 1024)).suf
!var %TotalVisibleMemorySize = $bytes($calc($WR(%n).TotalVisibleMemorySize * 1024)).suf
al Random Access Memory: $al %FreePhysicalMemory free of %TotalVisibleMemorySize
!inc %n
}
al
}
%what = PeakUsage,CurrentUsage,AllocatedBaseSize
if ($qu(SELECT %what FROM Win32_PageFileUsage)) {
!var %n = 1
while ($WR(%n).PeakUsage) {
!var %PeakUsage = $WR(%n).PeakUsage $+ MB
!var %CurrentUsage = $WR(%n).CurrentUsage $+ MB
!var %AllocatedBaseSize = $WR(%n).AllocatedBaseSize $+ MB
al Page File $chr(35) $+ %n $al(2) %CurrentUsage used of %AllocatedBaseSize (Peak: %PeakUsage $+ )
!inc %n
}
al
}
if ($qu(SELECT * FROM Win32_LogicalDisk)) {
!var %n = 1
al Available Drives:
while ($WR(%n).Name) {
!var %Name = $WR(%n).Name
!var %Size = $iif($WR(%n).Size,$ifmatch,0)
!var %FreeSpace = $iif($WR(%n).FreeSpace,$ifmatch,0)
!var %FileSystem = $iif($WR(%n).FileSystem,$ifmatch,Unknown)
!var %DriveType = $gettok(UnknownNo Root DirectoryRemoveable DiskLocal DiskNetwork DriveCompact DiscRAM Disk,$calc($WR(%n).DriveType + 1),1)
!var %VolumeName = $iif($WR(%n).VolumeName,$ifmatch,Unnamed)
al $al(2) %Name $al %VolumeName
al $al(3) $bytes(%FreeSpace).suf free of $bytes(%Size).suf ( $+ $round($calc(%FreeSpace / %Size * 100),2) % $+ ) - Type: %DriveType - Filesystem: %FileSystem
!inc %n
}
al
}
if ($qu(SELECT * FROM Win32_VideoController)) {
!var %n = 1
while ($WR(%n).Name) {
al GFX-Adapter $chr(35) $+ %n $al(2) $WR(%n).VideoProcessor
al - Name: $al(3) $WR(%n).Name w/ $bytes($WR(%n).AdapterRam).suf Memory
al - Vendor: $al(2) $WR(%n).AdapterCompatibility
al - Status: $al(3) $gettok(Other:Unknown:Running or Full Power:Warning:In Test:Not Applicable:Power Off:Offline:Off Duty:Degraded:Not Installed:Install Error:Power Save - Unknown:Power Save - Low Power Mode:Power Save - Standby:Power Cycle:Power Save - Warning:,$WR(%n).Availability,58)
!var %V = $WR(%n).CurrentVerticalResolution
!var %H = $WR(%n).CurrentHorizontalResolution
!var %P = $WR(%n).CurrentBitsPerPixel
if (%V && %H && %P) {
al - Resolution: $al(2) %H $+ x $+ %V $+ x $+ %P ( $+ $WR(%n).CurrentNumberOfColors colors $+ )
}
!var %R = $WR(%n).CurrentRefreshRate
if (%H) {
al - Refreshrate: $al(2) %R $+ Hz
}
al
!inc %n
}
}
if ($qu(SELECT * FROM Win32_PerfRawData_Tcpip_NetworkInterface WHERE Name <> 'MS TCP Loopback interface')) {
!var %n = 1
while ($WR(%n).Name) {
al Network Interface $chr(35) $+ %n $al $replace($WR(%n).Name, _, $chr(35)) - $calc($WR(%n).CurrentBandwidth / 1000000) $+ MBit/s
al - Data: $al(3) In: $bytes($WR(%n).BytesReceivedPerSec).suf - Out: $bytes($WR(%n).BytesSentPerSec).suf Total: $bytes($WR(%n).BytesTotalPerSec).suf
al - Packets: $al(2) In: $calc($WR(%n).PacketsReceivedNonUnicastPerSec + $WR(%n).PacketsReceivedPerSec + $WR(%n).PacketsReceivedUnicastPerSec) - Out: $calc($WR(%n).PacketsSentNonUnicastPerSec + $WR(%n).PacketsSentPerSec + $WR(%n).PacketsSentUnicastPerSec) - Errors/Unknown/Rejected: $calc($WR(%n).PacketsReceivedDiscarded + $WR(%n).PacketsReceivedErrors + $WR(%n).PacketsReceivedUnknown)
!inc %n
al
}
}
WC
}
else {
!var %1,%2,%3,%4
%1 = %1 OS: $gettok($WG(Win32_OperatingSystem).Name,1,124) $WG(Win32_OperatingSystem).CSDVersion ( $+ $WG(Win32_OperatingSystem).Version $+ ) Uptime: $unix.dur($uptime(system,3))
%1 = %1 CPU: $iif($WG(Win32_ComputerSystem).NumberOfProcessors > 1,$v1) $WG(Win32_Processor).Name $iif($WG(Win32_Processor).NumberOfCores > 1,with $v1 Cores each) ( $+ $gettok($wildtok(0:x861:MIPS2:Alpha3:PowerPC6:Intel Itanium Processor Family (IPF)9:x64,$WG(Win32_Processor).Architecture $+ :*,1,1),2,58) $+ ) @ $+($WG(Win32_Processor).CurrentClockSpeed,MHz) - $WG(Win32_Processor).LoadPercentage $+ % Load
%1 = %1 MEM: $bytes($calc($WG(CIM_OperatingSystem).FreePhysicalMemory * 1024)).suf free of $bytes($calc($WG(CIM_OperatingSystem).TotalVisibleMemorySize * 1024)).suf
!var %f = 0,%t = 0,%u = 0,%l = 0,%r = 0,%c = 0,%d = 0,%h = 0,%e = 0
if ($qu(SELECT * FROM Win32_LogicalDisk)) {
!var %n = 1
while ($WR(%n).Name) {
!var %Name = $WR(%n).Name
!var %Size = $iif($WR(%n).Size,$ifmatch,0)
!var %FreeSpace = $iif($WR(%n).FreeSpace,$ifmatch,0)
!var %FileSystem = $iif($WR(%n).FileSystem,$ifmatch,Unknown)
!var %DriveType = $gettok(UnknownNo Root DirectoryRemoveable DiskLocal DiskNetwork DriveCompact DiscRAM Disk,$calc($WR(%n).DriveType + 1),1)
!var %VolumeName = $iif($WR(%n).VolumeName,$ifmatch,Unnamed)
!inc %t %Size
!inc %f %FreeSpace
if (%DriveType == Unknown) !inc %u
if (%DriveType == Compact Disc) !inc %c
if (%DriveType == RAM Disk) !inc %d
if (%DriveType == Network Drive) !inc %l
if (%DriveType == Local Disk) !inc %h
if (%DriveType == Removeable Disk) !inc %e
!inc %n
}
}
%2 = %2 DiskSpace: $bytes(%f).suf of $bytes(%t).suf - $&
$iif(%e,%e Removeable Drives) $&
$iif(%h,%h Partitions) $&
$iif(%c,%c Compact Disk Drives) $&
$iif(%l,%l Network Drives) $&
$iif(%d,%d RAM Disk Drives) $&
$iif(%u,%u Unknown Drives)
if ($qu(SELECT * FROM Win32_VideoController)) {
%3 = %3 GFX:
!var %n = 1
while ($WR(%n).Name) {
%3 = %3 $chr(35) $+ %n $WR(%n).VideoProcessor w/ $bytes($WR(%n).AdapterRam).suf Memory
%3 = %3 is $gettok(Other:Unknown:Running or Full Power:Warning:In Test:Not Applicable:Power Off:Offline:Off Duty:Degraded:Not Installed:Install Error:Power Save - Unknown:Power Save - Low Power Mode:Power Save - Standby:Power Cycle:Power Save - Warning:,$WR(%n).Availability,58)
!var %V = $WR(%n).CurrentVerticalResolution
!var %H = $WR(%n).CurrentHorizontalResolution
!var %P = $WR(%n).CurrentBitsPerPixel
if (%V && %H && %P) {
%3 = %3 @ %H $+ x $+ %V $+ x $+ %P ( $+ $WR(%n).CurrentNumberOfColors colors $+ )
}
!var %R = $WR(%n).CurrentRefreshRate
if (%H) {
%3 = %3 %R $+ Hz
}
!inc %n
}
}
if ($qu(SELECT * FROM Win32_PageFileUsage)) {
%1 = %1 PageFile:
!var %n = 1
while ($WR(%n).PeakUsage) {
!var %PeakUsage = $WR(%n).PeakUsage $+ MB
!var %CurrentUsage = $WR(%n).CurrentUsage $+ MB
!var %AllocatedBaseSize = $WR(%n).AllocatedBaseSize $+ MB
%1 = %1 $chr(35) $+ %n %CurrentUsage used of %AllocatedBaseSize (Peak: %PeakUsage $+ )
!inc %n
}
}
if ($qu(SELECT * FROM Win32_PerfRawData_Tcpip_NetworkInterface WHERE Name <> 'MS TCP Loopback interface')) {
%4 = %4 Network:
!var %n = 1
while ($WR(%n).Name) {
%4 = %4 $chr(35) $+ %n $replace($WR(%n).Name, _, $chr(35)) @ $calc($WR(%n).CurrentBandwidth / 1000000) $+ MBit/s (In: $bytes($WR(%n).BytesReceivedPerSec).suf $+ /Out: $bytes($WR(%n).BytesSentPerSec).suf $+ )
!inc %n
}
}
WC
if ($1 == -s) {
if (%1) say %1
if (%2) say %2
if (%3) say %3
if (%4) say %4
}
elseif ($1 == -e) {
if (%1) echo $color(info) -ag %1
if (%2) echo $color(info) -ag %2
if (%3) echo $color(info) -ag %3
if (%4) echo $color(info) -ag %4
}
else {
!echo $color(info) -ag * /pcv2: Invalid Parameter
}
}
}
alias -l qu {
WC
!.comopen WMI WbemScripting.SWbemLocator
if ($com(WMI,ConnectServer,3,dispatch* WMI2) && $com(WMI2,ExecQuery,3,bstr*,$$1-,dispatch* WR)) {
return $true
}
goto end
:error
!reseterror
:end
return $false
}
alias -l al {
if ($isid) { return $str($chr(9),$iif($1 isnum,$1,1)) }
else { if ($dialog(pc)) { did -a pc 1 $1- $crlf } }
}
alias -l WC {
if ($com(WMI)) { !.comclose WMI }
if ($com(WMI2)) { !.comclose WMI2 }
if ($com(WR)) { !.comclose WR }
}
alias -l WR {
!var %x = $comval(WR,$iif($len($1),$1,1),$prop)
return %x
}
alias -l WG {
var %com = cominfo, %com2 = cominfo2, %com3 = cominfo3
if ($com(%com)) { !.comclose %com }
if ($com(%com2)) { !.comclose %com2 }
if ($com(%com3)) { !.comclose %com3 }
!.comopen %com WbemScripting.SWbemLocator
var %x = $com(%com,ConnectServer,3,dispatch* %com2), %x = $com(%com2,ExecQuery,3,bstr*,select $prop from $1,dispatch* %com3), %x = $comval(%com3,$iif($len($2),$2,1),$prop)
if ($com(%com)) { !.comclose %com }
if ($com(%com2)) { !.comclose %com2 }
if ($com(%com3)) { !.comclose %com3 }
return %x
}