Hello everyone!

I'm trying to get the value of the "IPAddress" property of the Win32_NetworkAdapterConfiguration WMI class, but I have not been successful. I believe the problem is that the property in question is an array.

Win32_NetworkAdapterConfiguration: https://msdn.microsoft.com/en-us/library/aa394217(v=vs.85).aspx#properties

My code:
Code:
alias myips {
  set -l %err
  :id
  set -l %id $ticks $+ $rand(1111,9999)
  if ($com(locator_ $+ %id)) || ($com(services_ $+ %id)) || ($com(result_ $+ %id)) goto id
  .comopen locator_ $+ %id WbemScripting.SWbemLocator
  if ($comerr) {
    %err = 1
    goto end
  }
  if (!$com(locator_ $+ %id,ConnectServer,3,dispatch* services_ $+ %id)) && ($comerr) {
    %err = 1
    goto end
  }

  if (!$com(services_ $+ %id,ExecQuery,3,bstr,Select * from Win32_NetworkAdapterConfiguration WHERE IPEnabled = "True",dispatch* result_ $+ %id)) && ($comerr) {
    %err = 1
    goto end
  }
  if (!$com(result_ $+ %id,Count,3)) {
    %err = 1
    goto end
  }

  set -l %x $com(result_ $+ %id).result
  while (%x) {
    echo -a Description: $comval(result_ $+ %id,%x,Description)
    echo -a IP: $comval(result_ $+ %id,%x,IPAddress)
    echo -a DNSServer: $comval(result_ $+ %id,%x,DNSServerSearchOrder)
    echo -a DNSDomain: $comval(result_ $+ %id,%x,DNSDomain)
    echo -a DNSHostName: $comval(result_ $+ %id,%x,DNSHostName)
    dec %x
  }

  :end
  if ($com(locator_ $+ %id)) .comclose locator_ $+ %id
  if ($com(services_ $+ %id)) .comclose services_ $+ %id
  if ($com(result_ $+ %id)) .comclose result_ $+ %id
}


I am trying to make this code with mIRC Scripting and COM because I can do it with mIRC Scripting, Java Script (or VBScript) and COM.


rockcavera
#Scripts @ irc.VirtuaLife.com.br