Home
32 Bit dBase
Misc.
Links
Contact

 

Subject: Read MAC Address
Date: Friday, March 28, 2003 9:40 PM

? getMacAddress()

function getMacAddress
  net = new OleAutoClient("wscript.network")
  computerName = net.computerName
  release object net
  comspec = getEnv("COMSPEC")
  sh = new OleAutoClient("wscript.shell")
  sh.run(comspec+" /c nbtstat -a "+computerName+;
  " > c:\INFO.txt",0,true )
  release object sh
  fso = new OleAutoClient("scripting.filesystemobject")
  ts = fso.opentextfile("c:\INFO.txt")
  macAddress = ""
  do while not ts.AtEndOfStream
     data = upper(ltrim(ts.readline()))
     if "MAC ADDRESS" $ data
        macAddress = rtrim(substr(data,at("=",data)+2))
        exit
     endIf
  enddo
  ts.close()
  release object ts
  fso.deletefile(c:\INFO.txt)
  release object fso
  return macAddress