Community discussions

MikroTik App
 
earljack
newbie
Topic Author
Posts: 40
Joined: Thu Jan 22, 2009 7:34 pm

Setting Property for Item in Console

Thu Feb 11, 2010 12:56 am

I'm sure someone can answer this question very easily. I'm embarrassed to have to ask it, but I don't know the intricacies of the console like I should. I'm trying to change a value of an item's property. For example In the address-list I would like to change the address list that 192.168.1.1 belongs to. I thought the following would work, but it doesn't:
set [find where address=192.168.1.1] list=SPAMMER
What am I doing wrong? The Wiki is lacking in advanced topics such as this. I am trying to learn scripting, and need to know how to do this before I can continue.

Thanks guys
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: Setting Property for Item in Console

Thu Feb 11, 2010 1:11 am

That syntax works for me. Maybe you're not in the right context?
[admin@MikroTik] > /ip firewall address-list print where list=test
Flags: X - disabled, D - dynamic
 #   LIST                       ADDRESS
 6   test                       192.168.1.1
[admin@MikroTik] > /ip firewall address-list set [/ip firewall address-list find address=192.168.1.1] list=test2
[admin@MikroTik] > /ip firewall address-list print where list=test2
Flags: X - disabled, D - dynamic
 #   LIST                       ADDRESS
 6   test2                      192.168.1.1
[admin@MikroTik] >
 
earljack
newbie
Topic Author
Posts: 40
Joined: Thu Jan 22, 2009 7:34 pm

Re: Setting Property for Item in Console

Thu Feb 11, 2010 1:22 am

My whole problem was I had "where" after "find". I have corrected my code to the following:
set [find address=192.168.1.1] list=SPAMMER
It works! Thanks for your help! Great example. Now off to learn some more scripting...

Who is online

Users browsing this forum: Bing [Bot], GoogleOther [Bot], MauriceW and 124 guests