Here's the basic code that I'm using:
<HTML>
<HEAD>
<TITLE>Webcam Controls</TITLE>
<script type="text/javascript">
function register() {
var keydown=window.event.keyCode;
var keyHit=false;
if (keydown==38)
{
document.keyaction.direction.value="up";keyHit=true;
}
if (keyHit==true)
{
document.keyaction.submit();
}
}
function init() {
document.onkeydown = register;
}
</script>
</HEAD>
<BODY onload="init();">
<form name="keyaction" action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST">
<input type="hidden" name="direction" value="null">
</form
<?php
if (isset($_POST['direction']) && $_POST['direction'] == "up")
{
system("up");
}
</body>
</html>
This JavaScript submits a PHP form when the 'up' arrow key is pressed. The PHP form runs a file on the server called up.exe
If you want to allow multiple actions, then use frames and have the JS call the PHP in the second frame and then the JS page wont have to refresh after each submit. All you do is substitute 'action="<?php echo $_SERVER['PHP_SELF'];?>"' with 'action="phpfile.php"' And put the code in the PHP file. (You can also place the form itself in the PHP file, in which case you'd have to use 'parent.frameone.keyaction.direction.value...etc. Basically direct it to the frame that has the form.
However being that the question has not yet been answered, I'd greatly appreciate it if someone has any ideas.
Thanks
PS- To the best of my understanding, it should not even take one full second to execute a file through a PHP form submit when running it on the server itself (I'd understand some delay if it were being used on the net- as it is ultimately intended for...) but right now I am testing it on the actual server itself...