I would like to ask about the scripts I found in this forum, to prompt the user to type characters:
First one -> viewtopic.php?f=9&t=38683#p284764
Second one (The y/n post) -> viewtopic.php?f=9&t=41042#p203961
I am doing a script who asks the user for a new Mikrotik Identity (At the end it will be an Auto-Setup script for our Network admins), but it doesn't store the value in the variable (Or this is what I think, you will know why later); so the Mikrotik Identity doesn't change.
The Policy (Permissions) of scripts are all enabled (Must fix in final version). First created the Prompt script, it's content is the exact as the First one link I posted above. Then, created a second one, named Setup, copied and adapted the content of the examples of use.
The script runs fine, but the Mikrotik Identity doesn't change. Saying that I typed an empty identity string, the [:put $mktiden] returns an empty string, but at System > Scripts > Environment I can see the name of the variable and it's value, the one I typed.
I'm wondering what's happening here; little help will be apreciated. I'm running RouterOS 5.19 on a RB450G. The code:
Code: Select all
/system script run Prompt
:put "Auto-Installation script";
:put " ";
# Prompt for Mikrotik Identity
:set runFunc [:parse (":global mktiden;" . \
":local input \"Mikrotik Identity? :\";" . \
$Prompt . \
":set mktiden \$output")
:put "You entered: $mktiden";
/system identity set name=$mktiden;