rendered paste bodyalias wminfostrings {
if ($1 == name) { return $wmiget(Win32_ComputerSystem).Name }
if ($1 == ostitle) { return $wmiget(Win32_OperatingSystem).Caption }
if ($1 == ossp) { return $wmiget(Win32_OperatingSystem).CSDVersion }
if ($1 == osver) { return $wmiget(Win32_OperatingSystem).Version }
if ($1 == osinstall) { return $asctime($ctime($iif($wmiget(Win32_OperatingSystem).InstallDate,$+($mid($ifmatch,7,2),/,$mid($ifmatch,5,2),/,$mid($ifmatch,1,4)) $+($mid($ifmatch,9,2),:,$mid($ifmatch,11,2),:,$mid($ifmatch,13,2))))) }
if ($1 == osarc) { return $wmiget(Win32_OperatingSystem).OSArchitecture }
if ($1 == up) { return $uptime(system,3) }
if ($1 == cpuname) { return $wmiget(Win32_Processor).Name }
if ($1 == cpuspeed) { return $+($wmiget(Win32_Processor).CurrentClockSpeed,MHz) }
if ($1 == cpuload) { return $iif($wmiget(Win32_Processor).LoadPercentage,$brak($+($ifmatch,% Load)),) }
if ($1 == cputotal) { return $wmiget(Win32_ComputerSystem).NumberOfProcessors }
if ($1 == cpul2cache) { return $wmiget(Win32_Processor).L2CacheSize $+ KB }
if ($1 == gpumake) { return $wmiget(Win32_VideoController).AdapterCompatibility }
if ($1 == gpuproc) { return $wmiget(Win32_VideoController).VideoProcessor }
if ($1 == gpuram) { return $bytes($wmiget(Win32_VideoController).AdapterRam,3).suf }
if ($1 == screenname) { return $wmiget(Win32_DesktopMonitor).Description }
if ($1 == res) { return $+($wmiget(Win32_VideoController).currenthorizontalresolution,x,$wmiget(Win32_VideoController).currentverticalresolution) }
if ($1 == resbit) { return $wmiget(Win32_VideoController).currentbitsperpixel $+ bit }
if ($1 == resrate) { return $wmiget(Win32_VideoController).currentrefreshrate $+ Hz }
if ($1 == rammax) { return $round($calc($wmiget(Win32_OperatingSystem).TotalVisibleMemorySize / 1024),1) }
if ($1 == ramuse) { return $round($calc($wmiget(Win32_OperatingSystem).FreePhysicalMemory / 1024), 1) }
if ($1 == netname) { return $wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).Name }
if ($1 == netspeed) { return $calc($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).CurrentBandwidth / 1000000) $+ Mb/s }
if ($1 == netin) { return $bytes($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).BytesReceivedPersec).suf }
if ($1 == netout) { return $bytes($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).BytesSentPersec).suf }
if ($1 == hdd) { var %i 1 | while (%i <= $disk(0)) { if ($disk(%i).type == fixed) var %var %var $disk(%i).path $+($bytes($disk(%i).free).suf,/,$bytes($disk(%i).size).suf) | inc %i } | return %var }
if ($1 == sound) { return $wmiget(Win32_SoundDevice).Name }
if ($1 == mobo) { return $wmiget(Win32_BaseBoard).Manufacturer $wmiget(Win32_BaseBoard).Product }
if ($1 == format) { return $asctime($file(C:\WIN32).ctime)) ( $+ $duration($calc($ctime - $file(C:\WIN32).ctime)) ago $+ ) }
}
;moo rambar - the famous rambar from the original script with a couple of changes
alias -l moorambar {
if ($len($1) < 990) {
var %moo.rb.size = 10
var %moo.rb.used = $round($calc($1 / 100 * %moo.rb.size),0)
var %moo.rb.unused = $round($calc(%moo.rb.size - %moo.rb.used),0)
var %moo.rb.usedstr = $str(|,%moo.rb.used)
var %moo.rb.unusedstr = $str(-,%moo.rb.unused)
if ((%moo.rb.usedstr) && (%moo.rb.unusedstr)) return $+([,%moo.rb.usedstr,%moo.rb.unusedstr,])
}
}
alias wmiget {
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($2,$2,1),$prop)
if ($com(%com)) { .comclose %com }
if ($com(%com2)) { .comclose %com2 }
if ($com(%com3)) { .comclose %com3 }
return %x
}
on *:connect: up x
alias calcdatatransfer {
set %indwsysinfo $wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).BytesReceivedPersec
set %outdwsysinfo $wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).BytesSentPersec
.noop $exec(net stats workstation $chr(124) d:\softwares\cygwin\bin\grep.exe "Bytes received" $chr(124) d:\softwares\cygwin\bin\sed.exe "s!^[^0-9]*!!", set %received)
.noop $exec(net stats workstation $chr(124) d:\softwares\cygwin\bin\grep.exe "Bytes trans" $chr(124) d:\softwares\cygwin\bin\sed.exe "s!^[^0-9]*!!", set %sent)
.timer -h 1 5000 updatedatatransfer
}
alias updatedatatransfer {
set %indwsysinfonew $wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).BytesReceivedPersec
set %outdwsysinfonew $wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).BytesSentPersec
say $hformat(Network) $wminfo(net,%received,%sent) $vsep $hformat(Bandwidth) $vformat($bytes($calc((%indwsysinfonew - %indwsysinfo)/5)).suf $+ /s - $bytes($calc((%outdwsysinfonew - %outdwsysinfo)/5)).suf $+ /s )
}
alias wminfo {
if ($1 == os) { return $vformat($wminfostrings(ostitle) - $wminfostrings(ossp) $brak($wminfostrings(osver))) }
if ($1 == up) { return $vformat($duration( $wminfostrings(up))) }
if ($1 == cpu) { return $vformat($wminfostrings(cpuname) $wminfostrings(cpuload)) }
if ($1 == gpu) { return $vformat($wminfostrings(gpumake) $wminfostrings(gpuproc) $brak($wminfostrings(gpuram))) }
if ($1 == res) { return $vformat($wminfostrings(screenname) $+ @ $+ $wminfostrings(res) $wminfostrings(resbit) $brak($wminfostrings(resrate))) }
if ($1 == ram) { var %moo.rammax = $wminfostrings(rammax) | var %moo.ramuse = $wminfostrings(ramuse) | return $vformat($+($round($calc(%moo.rammax - %moo.ramuse),0),/,%moo.rammax,MB) $+($chr(40),$round($calc((%moo.rammax - %moo.ramuse) / %moo.rammax * 100),2),%,$chr(41)) $moorambar($round($calc((%moo.rammax - %moo.ramuse) / %moo.rammax * 100),2))) }
if ($1 == hdd) { return $vformat($wminfostrings(hdd)) }
if ($1 == net) { return $vformat($iif($replace($wminfostrings(netname),- Packet Scheduler Miniport,),$ifmatch $iif($wminfostrings(netspeed), - $ifmatch, ) $brak(Total In: $bytes($2).suf / Total Out: $bytes($3).suf), )) }
if ($1 == format) { return $vformat($wminfostrings(format)) }
}
;;Let's make customization a bit easier.
;Header start
alias -l hstart return 14
;Header end
alias -l hend return :
;Value start
alias -l vstart return 7[10
;Value end
alias -l vend return 7]
;Value sep
alias -l vsep return $+(14,-,)
;Formatter
alias -l hformat return $hstart $+ $1- $+ $hend
alias -l vformat return $vstart $+ $1- $+ $vend
alias osinfo //say $hformat(Operating System) $wminfo(os) $vsep $hformat(Uptime) $wminfo(up)
alias up { ;uptime v0.4
$iif($timer(up) == $null,.timerup 0 60 up x)
if (($uptime(system,3) >= %up) || (%up == $null)) set %up $uptime(system,3)
$iif($1 == x,halt,$iif($chan,msg $chan,$iif($active == Status Window,echo,say)) $hformat(Operating System) $wminfo(os) $vsep $hformat(Uptime) $vformat($uptime(system,1) $brak(Best Recorded: $duration(%up))))
}
alias cpuinfo //say $hformat(CPU) $wminfo(cpu) $vsep $hformat(Memory) $wminfo(ram)
alias hddinfo //say $hformat(Hard Drives) $wminfo(hdd)
alias periphs //say $hformat(GPU) $wminfo(gpu) $vsep $hformat(Screen) $wminfo(res)
alias bw //calcdatatransfer
alias format //say $hformat(Last Format) $wminfo(format)