Hello,
I have a specific issue.
i am downloading some data with /tool fetch command
Thecontent of that file is in correct Mikrotik array format, but when i load it into a variable, it is not recognised as an array, but as an ordinary string instead.
:toarray transforms this string into an array with a single element, which is the complete string.
file contents: {“A”=“1”;“B”=“test”;“C”=“20”;“D”=“test2”;}
But this is not the only issue I am experiencing with loading stuff from file.
I also have issues with executing imported scripts.
I’m running 7.4.1 from stable branch on RB951
This is a simple example I’ve made just for this demonstration:
The $checkCreds function just skips over, and asks nothing. $readInput is not processed.
:if in $checkHost returns false, instead of true, and the $hostname variable is not even evaluated.
This only applies if the script is loaded from the rsc file.
if the code is pasted directly in the terminal, everything works as expected.
Why is this behaviour so unpredictable?
What am I missing?
the globals need to be registered inside the functions, which, in hindsight, makes sense.
since functions are also variables in RouterOS, they need to be declared as well.
However, this inconsistency is ridiculous.
How can one thing work in terminal, but not in imported script.
The contents of the variables are exactly the same. @RouterOS devs, please fix this.
I’m struggling with this same exact issue, and have had no luck. I see the response from rextended but the code snippet does not work (I’m not reading from a file, but using output=user for my fetch command, perhaps that changes things?) and I don’t see anything he’s posted before that solves the issue either.