loading
 
Using "SPEAK" interactively via HTML Camera Interface
John Cabrer from United States  [13 posts]
9 years
I wrote a script to generate audio when the camera is moved via the web interface ("Down!", "Up!", etc...), and made some cosmetic and functional modifications to the index.html page to make it look friendlier, and support multiple presets.  

Now I would like to add a text field that allows the person controlling the camera to type a message in a text field, press a button on the screen, and have that action result in a variable called SPEAK_MESSAGE that contains the message.  I can then pipe this value into SPEAK, and hear what the controller wants to say (you have to clear the value at the end of the RR script, otherwise it will repeat over and over).

I could probably figure this out, but I'm not familiar at all with javascript forms.  Any pointers would be greatly appreciated.
John Cabrer from United States  [13 posts] 9 years
Here is what I have been trying to do:


<tr>
  <td align=center>
    <input type="text" name="myMessage" value="">
    <input type="button" value="Send Message" onclick="setVariable('SPEAK_MESSAGE='+[myMessage])">
</tr>

The problem is that [myMessage] is not seen as a variable (at least not one with a value), so the text that is spoket is "Object!".
John Cabrer from United States  [13 posts] 9 years
Ok.  I got it!

<tr>
  <td align=center>
    <input type="text" name="myMessage" value="">
    <input type="button" value="Send Message" onclick="setVariable('SPEAK_MESSAGE='+document.getElementById('myMessage').value)">
</tr>
John Cabrer from United States  [13 posts] 9 years
If anyone want to check it out, here is the link:

http://movimed.dyndns.org:9999/
John Cabrer from United States  [13 posts] 9 years
Ooops!  This method only works in Internet Explorer!  Anybody know a better way to make this more widely compatible?
John Cabrer from United States  [13 posts] 9 years
<tr>
  <td colspan=2 align=center>
    <input type="text" id="myMessage" value="">
    <input type="button" value="Send Message" onclick="setVariable('SPEAK_MESSAGE='+document.getElementById('myMessage').value)">
  </td>
</tr>

Found that I needed to use "id=" instead of "name=", as FF and IE both understand "id=", but only IE understands "name="
Anonymous 9 years
Yup, you got it. I just tried it in FF and it seems to work well. Hey, you even waved back! Cool!!

STeven.

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index