Not tested very much, but it seems to work fine so far.
So..here it is.
Code: Select all
#SingleInstance, Force
#NoEnv
Gui, Add, Text, x0 w215 Center, Enter the first six characters or full MAC.
Gui, Add, Text, x10 y+10 w68 h12, Modem MAC:
Gui, Add, Edit, x+2 yp-3 w125 gCheckMACLen vMAC Limit17
Gui, Add, Text, x10 y+7 w68 h12, Vendor:
Gui, Add, Edit, x+2 yp-3 w125 ReadOnly vVendor
Gui, Add, Button, x10 y+7 w195 vSearchBtn gSearch, Search
Gui, Show, w215, MAC Vendor ID
GuiControl, Disable, SearchBtn
Return
CheckMACLen:
Gui, Submit, NoHide
StringReplace, MAC, MAC, %A_Space%,, All
Len := (StrLen(MAC))
If MAC
GuiControl, Enable, SearchBtn
Else
GuiControl, Disable, SearchBtn
If Len in 6,8,12,17
GuiControl, Enable, SearchBtn
Else
GuiControl, Disable, SearchBtn
Return
Search:
Gui, Submit, NoHide
Tout = 0
StringReplace, MAC, MAC, %A_Space%,, All
GuiControl,, Vendor, Searching...
WR := ComObjCreate("InternetExplorer.Application")
WR.Visible := False
WR.Navigate("www.coffer.com/mac_find/?string=" . MAC)
While WR.ReadyState < 4
{
Sleep, 100
If Tout = 50 ;Times out after 5 seconds (100 x 50 = 5000ms)
{
GuiControl,, Vendor, Timed out.
Return
}
Tout++
}
Elements := WR.document.getElementsByClassName("table2")
Ven := Elements[Elements.length-1].innerText
GuiControl,, Vendor, % Ven
WR.quit()
Return
GuiClose:
ExitApp