Anza
1
Hi to all,
I need to rename the wifi SSID with a partial date time, but I have some difficul with parse and variable:
:local date [/system clock get date];
:local months {“jan”=“01”;“feb”=“02”;“mar”=“03”;“apr”=“04”;“may”=“05”;“jun”=“06”;“jul”=“07”;“aug”=“08”;“sep”=“09”;“oct”=10;“nov”=11;“dec”=12};
:local day [:tonum [:pick $date 4 6]];:local year [:tonum [:pick $date 7 11]];:local month [:pick $date 0 3];:local mm (:$months->$month);
:local newdate “$year-$mm-$day”;
/interface wireless set wlan1 ssid=“newwifi" + newdate
Thanks, but is more appropriate downgrading this, also compatible with future routeros date format:
http://forum.mikrotik.com/t/changing-the-mmm-dd-yyyy-date-format/5183/10
:global setssidwithdate do={
/system clock
:local vdate [get date]
:local vdoff [:toarray "0,4,5,7,8,10"]
:local MM [:pick $vdate ($vdoff->2) ($vdoff->3)]
:local M [:tonum $MM]
:if ($vdate ~ ".../../....") do={
:set vdoff [:toarray "7,11,1,3,4,6"]
:set M ([:find "xxanebarprayunulugepctovecANEBARPRAYUNULUGEPCTOVEC" [:pick $vdate ($vdoff->2) ($vdoff->3)] -1] / 2)
:if ($M>12) do={:set M ($M - 12)}
:set MM [:pick (100 + $M) 1 3]
}
:local yyyy [:pick $vdate ($vdoff->0) ($vdoff->1)]
:local dd [:pick $vdate ($vdoff->4) ($vdoff->5)]
/interface wireless set $1 ssid="$2$yyyy-$MM-$dd"
:return "OK"
}
:put [$setssidwithdate wlan1 "newwifi"]