HowToScript to create new wireless interface, set new ssid, update ssid with another name ?
How to save script to file and have it run at a specified time automagically ?
I need to help my friend (girl) to buy used AP/router by Mikrotik next week,
learn to write some basic scripts, save scripts, set Scheduler to have some scripts run one after the another at i.e. 1 min delay
and have new wireless interface created, new ssid set from a file/ array/ preset variable
I read hyundrdes of web pages at forum by Mikrotik, saved many scripting examples
but not sure about syntax since examples are missing, have no access to htmlized manual, or ROS emulator
(since I plan to get routerOS next week)
Let me know your opinion
It's easy to start with Linux shell scripts, since I get hundreds of examples relevant to any task
If you are aware odf any such repository of Mikrotik scripts, listed by name, function, functionality in the htmlized (web-based) form , please let me know.
thank you
=================
enabvle/disable new wireless interface,
remove new wireless interface ?
I am visiting many links, like:
Functions and function parameters
viewtopic.php?t=75081
https://wiki.mikrotik.com/wiki/Manual:Scripting#Example
https://wiki.mikrotik.com/wiki/Manual:System/Scheduler
Sat Aug 03, 2013 2:15 pm
I got time today to play with this, so a few questions:
1) It seems you cant pass variables to functions, this should work, but doesnt:
ros code
:global PutValue do={
:put $1
}
:for i from=1 to=3 do={
:put $i
$PutValue $i
}
2) Can you not define functions as :local? This should work, but doesnt:
ros code
{
:local PutString do={
:put function
}
:for i from=1 to=3 do={
:put $i
$PutString
}
}
===
ros code
{
:local curTime
:local curDate
:set curTime [/sys clock get time]
:put [:typeof $curTime]
# works great with compares etc
:if ($curTime > "12:00:00") do={
:put "Its after noon"
} else={
:put "Its before noon"
}
# also works great
:put ($curTime + 1h)
:set curDate [/sys clock get date]
:put [:typeof $curDate]
# doesnt work since type is str
:if ($curDate > "jan/01/2013") do={
:put "We are after 2013"
} else={
:put "We are before 2013"
}
# doesnt work since type is str
:put ($curDate + 1d)
}
===
ros code
[admin@x86] > :global sum do={ :return ($1 + $2)}
[admin@x86] > :put (14 - [$sum 3 4])
7
===