Community discussions

MikroTik App
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

USER PROFILE

Fri Jul 22, 2022 1:48 am

Hello everyone, friends, I have a user profile "XXXX", how do I make it copy automatically in this line:

[/ip hotspot user profile get [find where name="XXXX"] mac-cookie-timeout]]

Thanks for your help.


EL DONCITO.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Fri Jul 22, 2022 10:43 am

Copy what to where?
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Fri Jul 22, 2022 1:21 pm

Thanks for answering friend JOTNE, what I want is for the script to copy the name of the USER PROFILE where the NAME is in this line
[/ip hotspot user profile get [find where name="XXXX"]] mac-cookie-timeout]]
I have a USER PROFILE with the name "XXXX" and I want that name to be copied to the name of the previous line.


EL DONCITO,
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Fri Jul 22, 2022 2:12 pm

Still unclear.
The command you have now, will give you the mac-cookie-timeout for the user-profile XXXX
What name do you like ( the name XXXX ?) to be stored where.

I have a USER PROFILE with the name "XXXX" and I want that name
                                     VVVV<-------------|
that here points to "XXXX", that you already have written, so this you already have.
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Fri Jul 22, 2022 2:58 pm

Exactly, what I want is to place in the previous command something that automatically assigns the name of the USER PROFILE.


EL DONCITO.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Fri Jul 22, 2022 7:26 pm

So you want to find User Profile with name XXXX and then change its name to something else?
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Fri Jul 22, 2022 9:52 pm

No friend, I want to find the USER PROFILE and automatically write it in the name of the previous command.


EL DONCITO.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Sat Jul 23, 2022 12:46 am

What is the previous command?

Post a flow diagram or complete code. This is very unclear and you only repeat your self.
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Sat Jul 23, 2022 12:50 am

:local atime [ /system clock get time ]
:local adate [ /system clock get date ]
:local comment "$user  conected : $adate  at: $atime"

:if ([ /ip hotspot user get $user comment ]="") do={ [ /ip hotspot user set $user comment=$comment ] }

[/system scheduler add name=$user on-event="/ip hotspot user remove \"$user\" \r\
  \n/ip hotspot cookie remove [find where user=\"$user\"] \r\
  \n/system scheduler remove [find where name=\"$user\"] \r\
  \n\r\
" interval= [/ip hotspot user profile get [find where name="XXXX"] mac-cookie-timeout]]
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Sun Jul 24, 2022 3:59 pm

Nothing JOTNE?



EL DONCITO.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Sun Jul 24, 2022 5:59 pm

I have given up. Does not understand what you want. Every time I ask, you reply with more or less the same.
Since no other has answered, I gess no other understand as well.
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Sun Jul 24, 2022 10:55 pm

Don't give up guys yet, how do I create a command to find the user profile "XXXX" and store it as a variable?




EL DONCITO.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: USER PROFILE

Mon Jul 25, 2022 4:55 am

Dije que sería mejor que estudiaras los script, tomaras cursos.
No puedes preguntar cada vez que arreglamos scripts estúpidos que encuentras en Internet,
o tenemos que escribirlos por usted si ni siquiera puede explicar lo que quiere.

¿Por qué buscar el nombre de perfil "XXXX" cuando ya sabes que el perfil se llama "XXXX"????
Obviamente, si haces la pregunta así, es una estupidez y cualquiera se daría por vencido, porque tú tampoco la entiendes.

¿Comprendido?


Another solution, if you are not able to do them yourself, hire someone to write the scripts for you, but mind that, even those who pay,
do not understand anything if you explain the things on that way, or they get bored.
For every script I made for you, instead of settling for you, you asked for dozens of changes,
as if I worked for you, you asked me for variations on the work requested.
It's one thing to provide something for free, as a favor, it's one thing to feel treated as if you were at work.
I already have mine.
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Tue Jul 26, 2022 8:45 pm

Friends, sorry for so much trouble, I found this searching here in the forum
:foreach i in=[/ip hotspot user profile find] do={
  :put "$[/ip hotspot user profile get $i name]";
}
that gives me all the names of my user profiles, how do I create a command that only gives me a single user profile?




EL DONCITO.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Tue Jul 26, 2022 9:47 pm

How do you like to find a single user, what is the unique input you have to find the user.

Example. You have a dns name like forum,mikrotik.com. This can be used to find one unique IP 159.148.147.239
Also what do you like to do with that user when its found.
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Tue Jul 26, 2022 10:14 pm

I want to find each user separately to put it in the following script that I am doing

:local atime [ /system clock get time ]
:local adate [ /system clock get date ]
:local comment "$user  conected : $adate  at: $atime"

:if ([ /ip hotspot user get $user comment ]="") do={ [ /ip hotspot user set $user comment=$comment ] }

[/system scheduler add name=$user on-event="/ip hotspot user remove \"$user\" \r\
  \n/ip hotspot cookie remove [find where user=\"$user\"] \r\
  \n/system scheduler remove [find where name=\"$user\"] \r\
  \n\r\
" interval= [/ip hotspot user profile get [find where name="XXXX"] mac-cookie-timeout]]

EL DONCITO.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Tue Jul 26, 2022 11:30 pm

This is just simple basic MiroTik scripting. If that is what you need, you should start learning scripting before you make scripts.

You can past this to terminal ans see whats result of it
# Get all ID for all user and loop trough one and one
:foreach id in=[/ip hotspot user profile find] do={

	# Get user name from each ID and store it to variable UserName
	:local UserName [/ip hotspot user profile get $id name]
	
	# Print the user name, or add the script part you like instead
	:put $UserName
}
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Wed Jul 27, 2022 12:38 am

the result is the same as with this
:foreach i in=[/ip hotspot user profile find] do={
  :put "$[/ip hotspot user profile get $i name]";
}


EL DONCITO.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Wed Jul 27, 2022 8:01 am

And then I still do not understand what you need. Gives up.
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Wed Jul 27, 2022 5:20 pm

What I want is for you to tell me how I can find a user profile, but only find one, not all the user profiles, give me an idea and I'll fix it. Thanks.



EL DONCITO.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Wed Jul 27, 2022 8:28 pm

To find something you need some to search for. Like comments, sittings, part of name.

I would like to find the user that has x y z.......
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Wed Jul 27, 2022 9:46 pm

How do I do this that you say?




EL DONCITO.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Wed Jul 27, 2022 11:12 pm

What do you not understand.

You like to find a USER.....
What are the criteria for finding the one, 1 user from all the other users????????????????????
Hi is big/fat/thin green/red ......
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Wed Jul 27, 2022 11:36 pm

Give me an example.
Give me an idea.



EL DONCITO.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Thu Jul 28, 2022 6:08 am

Its you that search for a solution, but you can not tell me what you want. I do not ask for help.
More strange request I have never seen.............
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Thu Jul 28, 2022 2:02 pm

I have a hotspot with multiple user profiles, if I use this command

 :foreach id in=[/ip hotspot user profile find] do={
{... 
{... :local UserName [/ip hotspot user profile get $id name]
{... 
{... :put $UserName
{... }
default
30min
1hour
TEST
name all the user profiles I have on the hotspot.
please I need you to help me make a command that only find a user profile for example the user profile TEST and the user profile 30min to place it on this line:
[/ip hotspot user profile get [find where name=" "]] mac-cookie-timeout]]
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: USER PROFILE

Thu Jul 28, 2022 2:39 pm

This is what you want, search profile name, from profile name
{
:local searchthis  "30min"
:local profilename ""
:local profilename [/ip hotspot user profile get [find where name="30min"] name]
:put "The name of profile $searchthis is $profilename"
}

or the simplified version:
{
:local searchthis  "30min"
:put "The name of profile $searchthis is $searchthis"
}
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Thu Jul 28, 2022 4:47 pm

How do I find a user profile that exists in my hotspot's user profile?



EL DONCITO.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: USER PROFILE

Thu Jul 28, 2022 9:13 pm

I have a hotspot with multiple user profiles, if I use this command

 :foreach id in=[/ip hotspot user profile find] do={
{... 
{... :local UserName [/ip hotspot user profile get $id name]
{... 
{... :put $UserName
{... }
default
30min
1hour
TEST
name all the user profiles I have on the hotspot.

I'll close here, it seems to me you're taking the piss...
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Sun Jul 31, 2022 11:07 pm

In my hotspot I have several user profiles, I want to create a script that looks for a name of the ones in the USER PROFILE

Give me an idea and I'll see how I can adapt it to my needs.



EL DONCITO.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Mon Aug 01, 2022 12:02 am

You do not get it????

To find a specific User in the User Profile, you need to have some search criteria that you fail to post.
Time to close thread.
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Mon Aug 01, 2022 12:20 am

Please give me an idea, something to guide me.



EL DONCITO.
 
User avatar
Jotne
Forum Guru
Forum Guru
Posts: 3279
Joined: Sat Dec 24, 2016 11:17 am
Location: Magrathean

Re: USER PROFILE

Mon Aug 01, 2022 8:34 am

Then start responding to what you are asked for to supply.
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE

Mon Aug 01, 2022 12:59 pm

In my hotspot I have several user profiles, I want to create a script that looks for a name of the ones in the USER PROFILE
Give me an idea and I'll see how I can adapt it to my needs.

[/ip hotspot user profile get [find where name="$user profile"] mac-cookie-timeout]]


EL DONCITO.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 11967
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: USER PROFILE

Mon Aug 01, 2022 2:38 pm

It is the exact copy of post #30 whit the addition of "script" on post #1, #3 and #26!!!

¡Busca a alguien que escriba bien en inglés, porque no entendemos lo que quieres!

{Look for someone who writes English well, because we don't understand what you want.}
 
eldoncito2019
Member
Member
Topic Author
Posts: 332
Joined: Fri Jun 14, 2019 1:07 pm

Re: USER PROFILE  [SOLVED]

Wed Aug 03, 2022 4:34 pm

I already found the solution:
:local userprofile [ip hotspot user get [find where name="$user"] profile]
 interval= [/ip hotspot user profile get [find where name="$userprofile"] mac-cookie-timeout]]

Thanks everyone for your help.


EL DONCITO.

Who is online

Users browsing this forum: No registered users and 28 guests