[/ip hotspot user profile get [find where name="XXXX"] mac-cookie-timeout]]
Thanks for your help.
EL DONCITO.
[/ip hotspot user profile get [find where name="XXXX"] mac-cookie-timeout]]
[/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
VVVV<-------------|
: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]]
:foreach i in=[/ip hotspot user profile find] do={
:put "$[/ip hotspot user profile get $i name]";
}
: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]]
# 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
}
:foreach i in=[/ip hotspot user profile find] do={
:put "$[/ip hotspot user profile get $i name]";
}
:foreach id in=[/ip hotspot user profile find] do={
{...
{... :local UserName [/ip hotspot user profile get $id name]
{...
{... :put $UserName
{... }
default
30min
1hour
TEST
[/ip hotspot user profile get [find where name=" "]] mac-cookie-timeout]]
{
: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"
}
{
:local searchthis "30min"
:put "The name of profile $searchthis is $searchthis"
}
I have a hotspot with multiple user profiles, if I use this command
name all the user profiles I have on the hotspot.Code: Select all:foreach id in=[/ip hotspot user profile find] do={ {... {... :local UserName [/ip hotspot user profile get $id name] {... {... :put $UserName {... } default 30min 1hour TEST
:local userprofile [ip hotspot user get [find where name="$user"] profile]
interval= [/ip hotspot user profile get [find where name="$userprofile"] mac-cookie-timeout]]