Quantcast
Channel: MikroTik
Viewing all articles
Browse latest Browse all 15394

Scripting • Re: Change script to new time format [SOLVED]

$
0
0
Again a bad formatted script, with same error as the last one. You NEED to remove one } at the end of the script.

Same script better formatted (without the } error).
Code:
:local dateint do={:local montharray ( "01","02","03","04","05","06","07","08","09","10","11","12" ):local days [ :pick $d 8 10 ]:local month [ :pick $d 5 7 ]:local year [ :pick $d 0 4 ]:local monthint ([ :find $montharray $month]):local month ($monthint + 1):if ( [len $month] = 1) do={:local zero ("0"):return [:tonum ("$year$zero$month$days")]} else={:return [:tonum ("$year$month$days")]}}:local timeint do={:local hours [ :pick $t 0 2 ]:local minutes [ :pick $t 3 5 ]:return ($hours * 60 + $minutes) }:local date [ /system clock get date ]:local time [ /system clock get time ]:local today [$dateint d=$date] :local curtime [$timeint t=$time] :local tyear [ :pick $date 0 4 ]:local lyear ($tyear-1):foreach i in=[ /ip hotspot user find where comment~"$tyear" || comment~"$lyear" ] do={:local comment [ /ip hotspot user get $i comment]:local limit [ /ip hotspot user get $i limit-uptime]:local name [ /ip hotspot user get $i name]:local gettime [:pic $comment 11 19]:if ([:pic $comment 4] = "-" and [:pic $comment 7] = "-") do={:local expd [$dateint d=$comment] :local expt [$timeint t=$gettime] :if (($expd < $today and $expt < $curtime) or ($expd < $today and $expt > $curtime) or ($expd = $today and $expt < $curtime) and $limit != "00:00:01") do={:if ([:pic $comment 21] = "N") do={[ /ip hotspot user set limit-uptime=1s $i ][ /ip hotspot active remove [find where user=$name] ]} else={[ /ip hotspot user remove $i ][ /ip hotspot active remove [find where user=$name] ]}}}}

Statistics: Posted by Jotne — Fri Mar 01, 2024 11:37 am



Viewing all articles
Browse latest Browse all 15394

Trending Articles