Special EL DONCITO version
Date on abbreviated venezuelan montn name/ day / year and Time on AM/PM format
http://forum.mikrotik.com/t/can-it-be-done-with-a-script/157158/10
http://forum.mikrotik.com/t/one-last-little-help-please/157270/1
{
:local filename "lastupurl.txt"
:local timeout 60
:local url "http://worldtimeapi.org/api/timezone/America/Caracas.txt"
/file
remove [find where name="fetchtest.txt"]
remove [find where name="fetchnow.txt"]
:local jobid [:execute file=fetchtest.txt script="/tool fetch url=\"$url\" dst-path=fetchnow.txt"]
:local Gltesec 0
:while (([:len [/sys script job find where .id=$jobid]] = 1) && ($Gltesec < $timeout)) do={:set Gltesec ($Gltesec + 1); :delay 1s}
:if ([:len [find where name="fetchnow.txt"]] = 1) do={
:local filecontent [get [find where name="fetchnow.txt"] contents]
:local dstart ([:find $filecontent "datetime: " -1] + 10)
:local year [:pick $filecontent $dstart ($dstart + 4)]
:local month [:pick $filecontent ($dstart + 5 ) ($dstart + 7)]
:local day [:pick $filecontent ($dstart + 8 ) ($dstart + 10)]
:local hms [:pick $filecontent ($dstart + 11 ) ($dstart + 19)]
:if ([:len [find where name="flash" and type="disk"]] = 1) do={:set filename "flash/$filename"}
:if ([:len [find where name=$filename]] = 0) do={print file="$filename"; :delay 5s; set $filename contents=""}
:delay 5s
:global arrMonths {"01"="ENE";"02"="FEB";"03"="MAR";"04"="ABR";"05"="MAY";"06"="JUN";\
"07"="JUL";"08"="AGO";"09"="SEP";"10"="OCT";"11"="NOV";"12"="DIC"}
:local mhours [:tonum [:pick $hms 0 2]]
:local minsec [:pick $hms 2 8]
:local msymbl "AM"
:if ($mhours > 11) do={:set msymbl "PM"}
:set mhours ($mhours % 12)
:if ($mhours = 0) do={:set mhours 12}
:if ($mhours < 10) do={:set mhours "0$mhours"}
set $filename contents="Date: $($arrMonths->$month)/$day/$year\r\nTime: $mhours$minsec $msymbl\r\n\
Uptime: $[/system resource get uptime]"
}
remove [find where name="fetchtest.txt"]
remove [find where name="fetchnow.txt"]
}
Date: ABR/20/2022
Time: 04:49:23 AM
Uptime: 00:02:26