How to: Ask 4 and Get something from the keyBoard?

Monkey Targets Forums/HTML5/How to: Ask 4 and Get something from the keyBoard?

vmars316(Posted 2013) [#1]
Hello & Thanks:
1) How to Stop/Pause execution ?
I would like to Pause after a Print command .

1) Also I would like to Ask for and Get something back from the keyBoard .
I have tried Stop , Get , Pause , Input , but can't find the right keywords .

Thanks..vm


Midimaster(Posted 2013) [#2]
During the development/testing I use in such cases ...
Error ""

... but this stops the app without possibility of continuing...

I also have this line in combination with ESC-key in the OnUpdate(). So I can stop the app ar every time:
	Method OnUpdate%()
		If KeyHit(KEY_ESCAPE) Then Error ""
....



Beaker(Posted 2013) [#3]
For user input take a look at "bananas/beaker/angelfont/angelfont_example.monkey" in your monkey folder.

Also, "bananas/mak/keyboardtest/keyboardtest.monkey".

If you want to just detect key presses (in mojo), you can use KeyHit() and KeyDown().


vmars316(Posted 2013) [#4]
Yes , that 'angelfont_example.monkey' and 'keyboardtest.monkey' are interesting .
I was hoping for something more simple , like below .
A .monkey 'jsPROMPT' 'jsCONFIRM' or 'jsINPUT' commands would be wonderful .
Or maybe adding a command that would allow EMBEDding javascript code
into .Monkey code ? jsEMBED . ...Thanks..vm

<!DOCTYPE html>
<html>
<body>
<p>Click the button to demonstrate the prompt box.</p>
<script>
function myFunction()
{
var x;
var person=prompt("Please enter your name","Here");
if (person != null)
  {
  x="Hello " + person + "! How are you today?";
  document.getElementById("demo").innerHTML=x;
  }
}
</script>

<button onclick="myFunction()">Try it</button>
<p id="demo"></p>

</body>
</html>