Community discussions

MikroTik App
 
B_U_L_I
just joined
Topic Author
Posts: 9
Joined: Wed Nov 01, 2006 11:02 am

Problem with "name rewrites script"

Wed Feb 04, 2009 3:22 am

Hi
I hawe a problem with the script:
 :foreach ip in=[/ip firewall address-list find list=("USERS_ON_LAN")] do={/i
p firewall address-list  set [find list=("USERS_ON_LAN") address=[/ip firewall address-list g
et $ip address]] comment=[/queue simple get [find target-addresses=[/ip firewall address-list
 get $ip address]] name ]} 
The script is to move the names of the queues in the addresslist comment. I used it in version 2.9 and work there without a problem I have now 3.20 and I can not run it. Where do I make an error.
 
User avatar
nest
Forum Veteran
Forum Veteran
Posts: 823
Joined: Tue Feb 27, 2007 1:52 am
Location: UK
Contact:

Re: Problem with "name rewrites script"

Thu Mar 05, 2009 5:40 pm

I think the problem is that you have to set the variables you intend to use at the top of your script before using them?
# Set local variables
:local ip
 
User avatar
janisk
MikroTik Support
MikroTik Support
Posts: 6263
Joined: Tue Feb 14, 2006 9:46 am
Location: Riga, Latvia

Re: Problem with "name rewrites script"

Mon Mar 09, 2009 12:08 pm

yes that should be the case, you have to initiate it first, even if you intend to use global variable and then you can access its value.