I'm having a problem with @IPAddress1 & @IPAddress2 where it seems like @IPAddress1 refers to the first active IP address but isn't necessarily tied to a specific network adapter.
I have a script that checks the IP address of each at each index then posts them to a listview, however if I disconnect the first NIC, the IP address that was listed at @IPAddress2 is now shows at @IPAddress1.
Which also results in @IPAddress2 reporting "0.0.0.0" for its IP.
Is this something I should expect to happen?
Is there a way to get the address of a specific NIC easily?
AutoIt
#include <GUIConstantsEx.au3> #include <ListViewConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate("IP Check", 240, 120) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") $ip1 = @IPAddress1 $ip2 = @IPAddress2 $listview = GUICtrlCreateListView("| IP 1 | IP 2", 10, 10, 220, 100, $LVSCW_AUTOSIZE) $listviewitem = GUICtrlCreateListViewItem(" | " & $ip1 & " | " & $ip2, $listview) GUISetState(@SW_SHOW) While 1 If @IPAddress1 <> $ip1 Or @IPAddress2 <> $ip2 Then GUICtrlSetData($listviewitem, " | " & @IPaddress1 & " | " & @IPAddress2) $ip1 = @IPAddress1 $ip2 = @IPAddress2 Else Sleep(1000) EndIf WEnd Func CLOSEClicked() ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, ;@GUI_WINHANDLE will be either $mainwindow or $dummywindow If @GUI_WINHANDLE = $mainwindow Then Exit EndIf EndFunc