:while (/ip route x.y enable)

How can I script the following problem:

while (ip route [where dst-address=xyz] enable) do {
}

So while one of row of the routing table where dst-address=xyz is enable, do something

:foreach i in=[/ip route find dst-address=xyz] do={
/ip route enable $i
}

while (/ip route where dst-address=0.0.0.0/0 is gateway=abcd) do={
if ([/ping abcd count=5] < 1) do={
/ip route set [find dst-address=0.0.0.0/0] gateway=dcba;
}
}

So I like to change the gateway to dcba when the abcd is not answer. But I can not do the row no.1

cmon have you seen my post above? I wrote a working example, use it, modify it for your needs.

Your script won’t work, because console doesn’t have ‘where’ command, also while should start with ‘:’ and there is no ‘is’ operator.

You can find all available commands and operators in scripting manual:
http://wiki.mikrotik.com/wiki/Scripting

Cmon, I have written a schema, not a WORKING script. Your “example” is very far from I like to do. I think You didn’t understand the main problem.

try this out.

{:local i 0; {:do {:set i ($i + 1)} while=(($i < 5) && ([/ping x.y.x.z interval=3 count=1]=0))}; :if ($i=5 && [/ip route get [find dst-address=0.0.0.0/0] gateway]=abcd) do={:log info "Main Gateway DOWN"; /ip route set [find dst-address=0.0.0.0/0] gateway=dcba}}

first of all - if you write some schema or something, add comment to what you have done.

second, if you are having problems, describe problem, not just write something and wait for someone else to guess the problem.

and third, if you have netwatch, use it and do not reinvent the wheel.
then it would be - if gateway comes up do a, if goes down then do b.

Thank YOU!