Need script to skip and resume on errors

for i from=2 to=254 do={ /ip arp add address=(“192.168.1.” . $i) mac-address=(“001122334455”) interface=(“bridge1”) }

At the moment the script will go through and start adding all the entries into the router but it will stop when it gets to an ip address already assigned in the router. If the ip address is already in use I need it to skip to the next ip in line and resume. Any help would be greatly appreciated.

:for i from=2 to=254 do={ 
  :local IP "192.168.1.$i";
  :if ([:len [/ip arp find address="$IP"]] > 0) do={
    :put "$IP already has an ARP mapping!";
  } else={
    /ip arp add address="$IP" mac-address="001122334455" interface="bridge1";
  }
}

That works when I use it while logged into the router using Putty/SSH, but it doesn’t work when I put it into the winbox terminal. Any idea on how to change it in order for it to work through the winbox terminal?

Edit- Nevermind, doing it through putty for now is fine. Thank you for the help

what response did you get when you did that through winbox terminal? AFAIK there should be no difference as same console is working on CLI and it is also launched in winbox terminal.

Well for some reason it works now through winbox terminal, not sure what it was doing yesterday.
The problem I have now is that I was testing this script on a router with 4.11 software and it worked great, but it’s not working on the router with 3.25.

Make a script with that content, then edit the source from the CLI. That will give you syntax highlighting - where it stops highlighting is where the error is. I don’t have anything that old to rewrite it on.

http://img710.imageshack.us/i/84170026.png/

There is a link to a screenshot I took. I’m new to this, so it’s still confusing to me.

Whoops, my bad. I missed a character. Replace the initial “for” with “:for”. I’ve also edited the post to reflect that.

That worked. Thanks for the help, I really appreciate it.