mIRC Homepage


Posted By: sparta

wmiget - 10/10/11 10:55 PM

$wmiget(Win32_PerfRawData_Tcpip_NetworkInterface).Name , with this line i can grab the name of the network card, but if i have two it only return the first one, how can i get the information from the other? i dont want to use dll for this. And any other usefull information that can be grabed from the network card? like duplex and so on?
Posted By: Wims

Re: wmiget - 10/10/11 11:19 PM

The $wmiget alias isn't supposed to be used to get more than one result, use your own code:
alias getInet {
  .comopen a WbemScripting.SWbemLocator
  .comclose a $com(a,ConnectServer,3,dispatch* b) 
  .comclose b $com(b,ExecQuery,3,bstr*,select Name from Win32_PerfRawData_Tcpip_NetworkInterface,dispatch* c)
  var %r = $comval(c,0)
  while (%r) { echo -a $comval(c,%r,Name) | dec %r }
  if ($error) reseterror 
  if ($com(a)) .comclose a
  if ($com(b)) .comclose b
  if ($com(c)) .comclose c
You can get more properties (thing like Name) here
Posted By: sparta

Re: wmiget - 10/10/11 11:24 PM

Thank you, but found out a way..

//echo -a $wmiget(Win32_PerfRawData_Tcpip_NetworkInterface,2).Name

The ,2 tell me the name of my network card no 2..
Posted By: Wims

Re: wmiget - 11/10/11 12:13 AM

Yeah.. the point being that each time you call $wmiget(,N) it makes a new connection, which is very slow and not a good solution
Posted By: sparta

Re: wmiget - 11/10/11 09:12 AM

I could not get your code to give me the amount of data transfered.

$calc($wmiget(Win32_PerfRawData_Tcpip_NetworkInterface,2).CurrentBandwidth / 1000000) $+ MB/s

I tested to edit your code to get it, but it always return 0 . I guess i did somthing wrong..
Posted By: Wims

Re: wmiget - 11/10/11 01:37 PM

The CurrentBandwidth property doesn't return anything for me either, there's nothing you can do about this, the code is working.
Posted By: Riamus2

Re: wmiget - 11/10/11 04:21 PM

CurrentBandwidth and various other properties are not always available depending on hardware and operating system. Current Bandwidth is especially troublesome in this regard, so if you want current bandwidth including what is used outside of mIRC, you'll need another method of obtaining it.
© 2020 mIRC Discussion Forums