Community discussions

MikroTik App
 
DoubleDB
newbie
Topic Author
Posts: 25
Joined: Thu Feb 20, 2020 12:53 am

Script - get item numbers

Tue May 09, 2023 5:17 pm

Hey guys,

I'd like to create a comma-separated string containing the actual ***numbers*** of each elements (not the *An's) so I can then call /user-manager/user generate-voucher numbers=<the generated list of IDs> . . . .

numbers_list "";
foreach i in=[/user-manager/user/find where disabled=no] do={
xxx
}

How to get/convert the *A5 / *Awhatever to the actual numbers shown in /user-manager/user print detail where disabled=no ???!
I've tried everything I could think of - I can either print *A5 *A23978382459348, or - nothing at all.

Regards,
D
 
pe1chl
Forum Guru
Forum Guru
Posts: 10208
Joined: Mon Jun 08, 2015 12:09 pm

Re: Script - get item numbers

Tue May 09, 2023 5:49 pm

Item numbers are only valid in the user interface, not in scripts. The numbers are generated when a "print" command is used and are only valid for that login session.
To refer to items in scripts you always need to use [find ...], not item numbers.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11986
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Script - get item numbers

Tue May 09, 2023 6:03 pm

/user-manager user generate-voucher [find where disabled=no]
 
DoubleDB
newbie
Topic Author
Posts: 25
Joined: Thu Feb 20, 2020 12:53 am

Re: Script - get item numbers

Tue May 09, 2023 6:23 pm

Item numbers are only valid in the user interface, not in scripts. The numbers are generated when a "print" command is used and are only valid for that login session.
To refer to items in scripts you always need to use [find ...], not item numbers.
So, how do I pass the [find] to generate-vouchers for only the active items?
***edt - thanks for the above post.

Who is online

Users browsing this forum: No registered users and 9 guests