Community discussions

MikroTik App
 
namo
Long time Member
Long time Member
Topic Author
Posts: 530
Joined: Sat Oct 03, 2009 4:44 pm

Is it possible to edit the comment using script ?

Sun Oct 16, 2011 7:25 pm

I have Mikrotik RouterOs v5.7 with hotspot.

Is it possible to get all users with "$" in their comment and change them from user profile "0400kbps money" to user profile "0400kbps" . And then delete "$" from the comment

for example

user: AK2011
profile: 0400kbps money
comment: Allen Walker $

I want change using script to

user: AK2011
profile: 0400kbps
comment: Allen Walker
 
tjc
Member Candidate
Member Candidate
Posts: 276
Joined: Sun Jul 10, 2011 3:08 am

Re: Is it possible to edit the comment using script ?

Mon Oct 17, 2011 7:20 am

Yes.

Mostly anyway. You need a find that matches the comment. There are examples in the script samples on the wiki. Once you find the matching records you can set the profile and comment. Doing the string munging is a bit harder. Huh it looks like find works on strings too...

So find to locate the records with matching comments, a for loop to iterate over them, and gets to grab the field values, then some string munging, and finally sets to update them.