If code run without ":delay 0.1" one of the variable doesn't set.
Any variables before and after this line set fine.:execute ":global $ip [:pick \$$ipNet 0 [:find \$$ipNet \"/\" -1]]"
Only after added ":delay 0.1" the variable
set.:execute ":global $ip ..
Maybe do anyone know why need ":delay" ?
Code: Select all
:global getIpsettings do={
:local int
:if ([:len [/ip address find interface=$int1]]!=0) do={
:set int $int1
} else={
:set int $int2
}
:local intName ($type . "Inteface")
:execute ":global $intName $int"
:local ipNet ($type . "IpNet")
:execute ":global $ipNet [/ip address get [find interface=$int] address]"
:delay 0.1
:local ip ($type . "Ip")
:execute ":global $ip [:pick \$$ipNet 0 [:find \$$ipNet \"/\" -1]]"
:local net ($type . "Net")
:execute ":global $net [/ip address get [find interface=$int] network]"
}
$getIpsettings int1=ether1 int2=ppp-out1 type=isp1