Community discussions

MikroTik App
Topic Author
Posts: 37
Joined: Tue Jan 15, 2013 9:14 pm

help with address-list script please

Wed Sep 24, 2014 9:45 am

I'm writing a script that adds a route for each entry in an address-list, but I keep getting an error when more than 1 entry exists.

:foreach i in=[/ip firewall address-list get [find list=blocked] address] do={
:log info ($i)
I get:
invalid internal item number

If there's 1 address in the list it's fine but more than 1 then it gives that error.

What am I doing wrong? I need it to work with more than 1 address list entry.

Thanks for any help!

edit: I'm using RouterOS 6.15
User avatar
Long time Member
Long time Member
Posts: 558
Joined: Mon Jul 25, 2011 9:42 pm
Location: [admin@Chile] >

Re: help with address-list script please

Thu Sep 25, 2014 9:12 pm

is wrong your script, check this:

ros code

foreach i in=[ip firewall address-list find list=blocked ] do={
local ip [ip firewall address-list get value-name=address $i]
log info ($ip) }
Member Candidate
Member Candidate
Posts: 161
Joined: Sun Dec 06, 2009 1:36 pm
Location: Denmark

Re: help with address-list script please

Thu Sep 25, 2014 9:23 pm

/ip firewall address-list {
    :foreach i in=[find list=blocked] do={
        :log info [get $i address]

Who is online

Users browsing this forum: sistelec and 32 guests