Community discussions

MikroTik App
 
lcpwc
just joined
Topic Author
Posts: 16
Joined: Thu Apr 26, 2018 1:49 pm

Handling different syntax

Thu Apr 26, 2018 2:48 pm

Hi all,
I've a (quite complex) set of script for managing 100+ AP in my company.
It worked flawlessy untile I upgraded a test AP to 6.41

I discovered that Mikrotik change the way to configure IP discovery and mac-servers.
I upgraded the script to the new syntax, but now script is failing on AP still on 6.40 or lower.

What is the best practice to handle different syntax based on version? I tried the do on-error approach but script fails to load complaining about a wrong syntax even if it's inside a do block.
Am I missing a function in scripting or there is no way to handle different syntax based on different RouterOS versions?
Thanks in advance
 
dada
Member Candidate
Member Candidate
Posts: 245
Joined: Tue Feb 21, 2006 1:44 pm

Re: Handling different syntax

Thu Apr 26, 2018 3:42 pm

Hi,

you have to detect actual ROS version in your script and then you have to fill appropriate commands into a string and then execute the string :parse. An example:

set cfgstr "place you commands here";
local func [:parse $cfgstr];
$func;

Who is online

Users browsing this forum: No registered users and 69 guests