Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

check array dimension

$
0
0
Hi,

the function IPDetails returns an 2 dimensional array, with all info of the network interfaces it finds.
In the first dimension $aArray[x] is the network interface. The second part $aArray[][x] is the info.
(for example $aArray[1][1]  will show you the ip adress for the first network interface.
$aArray[1][2] will show you the mac address of the first interface)


Now, when there are no network interfaces the array is empty.

IPDetails function :
http://www.autoitscript.com/forum/topic/128276-display-ip-address-default-gateway-dns-servers/#entry890228

Func IPMenu()
$aArray = _IPDetails()
   if $aArray[1][1] Then --> get error here
   GUICtrlSetData ($lIP,$aArray[1][1])
EndIf
.... //rest of code

When I run this script i get an error : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded. This is becaus $aArray[1][] doesnt exist. (no network interfaces found)


How can you check if the array is empty or not? I need to be sure that $aArray[x][1] ,, that the X exists.

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>