Community discussions

MikroTik App
 
User avatar
gabak
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Sep 01, 2006 7:10 am

how to save queues list into a TXT ??

Sun May 05, 2013 5:55 am

i have a long list with all my user and i want to take to other mt i got.

thxs in advance
 
adairw
Frequent Visitor
Frequent Visitor
Posts: 60
Joined: Sun Jan 29, 2012 6:32 pm

Re: how to save queues list into a TXT ??

Sun May 05, 2013 7:24 am

Export compact to a file and copy the bits you want?
 
User avatar
gabak
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Sep 01, 2006 7:10 am

Re: how to save queues list into a TXT ??

Mon May 06, 2013 7:24 pm

thank you so much for your quick answer.
please tell me how to do that.
i dont see export menu.
Export compact to a file and copy the bits you want?
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: how to save queues list into a TXT ??

Mon May 06, 2013 7:26 pm

From a terminal.

Click "New Terminal", type

ros code

/queue simple export file="queues.txt"
and hit enter.
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
User avatar
gabak
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Sep 01, 2006 7:10 am

Re: how to save queues list into a TXT ??

Mon May 06, 2013 7:42 pm

thank you
it works !!

1-other question how can u save just the name field?
2-or can it be save in xls format? ;-) hehe
From a terminal.

Click "New Terminal", type

ros code

/queue simple export file="queues.txt"
and hit enter.
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: how to save queues list into a TXT ??

Mon May 06, 2013 9:03 pm

Not directly and/or easily.

To export just the names, you could create a custom script at "/system script", but you'd have to learn scripting for that.

For Excel, it's even harder. The easiest way is to create a CSV file using scripting. Alternatively, if you know any programming language (C, PHP, JAVA, C#, etc.), you could connect to the router using the API protocol and use whatever other libraries are available to that language to programmatically create Excel files.
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
User avatar
gabak
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Sep 01, 2006 7:10 am

Re: how to save queues list into a TXT ??

Mon May 06, 2013 9:09 pm

can u help me with that?
do you have a script that would help me with that?

this is the way i made the queues.
:for e from=3 to=254 do={
/queue simple add name="user $e" target-addresses="10.0.0.$e" max-limit=244000/2804000 queue=default/default total-queue=default
}




Not directly and/or easily.

To export just the names, you could create a custom script at "/system script", but you'd have to learn scripting for that.

For Excel, it's even harder. The easiest way is to create a CSV file using scripting. Alternatively, if you know any programming language (C, PHP, JAVA, C#, etc.), you could connect to the router using the API protocol and use whatever other libraries are available to that language to programmatically create Excel files.
 
User avatar
boen_robot
Forum Guru
Forum Guru
Posts: 2411
Joined: Thu Aug 31, 2006 4:43 pm
Location: europe://Bulgaria/Plovdiv

Re: how to save queues list into a TXT ??

Mon May 06, 2013 9:21 pm

I think the following should work generating a list of names (one per row)

ros code

:local "filename" "queue_names.txt";

#Create a (nearly) empty file to overwrite later
/file print file=$filename where 1=0;
:local contents "";
/queue simple
:foreach "queue" in=[find] do={
    :set "contents" ($contents . [get $queue "name"] . "\n"); 
};
/file set $filename contents=$contents;
I think Excel might be able to extrapolate that into a column of values, but I'm not sure. If it doesn't, you'd have to figure out what it does and does not accept from text files before reworking the script accordingly.
PEAR2_Net_RouterOS(1.0.0b6) - My API client in PHP
(Rate my posts? If you want... no pressure...)
 
User avatar
gabak
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 61
Joined: Fri Sep 01, 2006 7:10 am

Re: how to save queues list into a TXT ??

Tue May 07, 2013 6:03 am

i ll be happy just to get a txt with field name only, the excel file will be a bonus ;-)

i did what you told me and i get an error and a txt file with everything instead of just field name.


here it is what is said

[admin@MikroTik] > :local "filename" "queue_names.txt";
[admin@MikroTik] >
[admin@MikroTik] > #Create a (nearly) empty file to overwrite later
[admin@MikroTik] > /file print file=$filename where 1=0;
syntax error (line 1 column 19)
[admin@MikroTik] > :local contents "";
[admin@MikroTik] > /queue simple
[admin@MikroTik] /queue simple> :foreach "queue" in=[find] do={
{... :set "contents" ($contents . [get $queue "name"] . "\n");
expected variable name (line 2 column 10)
[admin@MikroTik] /queue simple> };
[admin@MikroTik] /queue simple> /file set $filename contents=$contents;
syntax error (line 1 column 12)
[admin@MikroTik] /queue simple>


I think the following should work generating a list of names (one per row)

ros code

:local "filename" "queue_names.txt";

#Create a (nearly) empty file to overwrite later
/file print file=$filename where 1=0;
:local contents "";
/queue simple
:foreach "queue" in=[find] do={
    :set "contents" ($contents . [get $queue "name"] . "\n"); 
};
/file set $filename contents=$contents;
I think Excel might be able to extrapolate that into a column of values, but I'm not sure. If it doesn't, you'd have to figure out what it does and does not accept from text files before reworking the script accordingly.
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 24555
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: how to save queues list into a TXT ??

Tue May 07, 2013 11:15 am

you must post that into the script editor on menu "system script", then run it. not just command line anywhere
No answer to your question? How to write posts

Who is online

Users browsing this forum: amt, Google [Bot], kahn, mobilemail and 61 guests