I am writing a Roku application and I need to read a string from the standard input. I am aware that to print to the standard output I can use the function print
, but I need to give to the user the launches the script the possibility to insert new parameters at run time, for example (pseudo-code):
print "Enter server IP: "
string ip = getline();
print "Server IP " + ip
Is there a way to do it?
You would need to add Keyboad*** component to your Scene.xml file:
After that add a Button component in Scene.xml, declare it in Scene.brs - init() function and set observer field on "buttonSelected".Also declare keyboard and set focus on it:
init() :
Then create a Sub to get a user input from Keyboard when button is pressed:
***Note that Keyboard component has TextEditBox build in so you don't have to add it manually in Scene.xml file.