Hi All,
I have been wrestling with trying to get a simple python script to run on the click event of an HTML button. Here is the python script:
It issues a "play" command to a remote VTR. I have the script in my server's "cgi-bin" folder and I have the cgi module enabled in my httpd.conf file. I am trying to call the script through AJAX that is executed through the onclick event of an HTML "play" button.. Here is my page:
If I double click the python script directly it does work and a "play" command is issued to the target machine... and it plays
Any help is appreciated as I am just learning python.
Thanks,
Ken
I have been wrestling with trying to get a simple python script to run on the click event of an HTML button. Here is the python script:
Python:
#!C:\Python27
import kipro
client = kipro.Client('[URL unfurl="true"]http://10.221.14.161')[/URL]
client.play()
It issues a "play" command to a remote VTR. I have the script in my server's "cgi-bin" folder and I have the cgi module enabled in my httpd.conf file. I am trying to call the script through AJAX that is executed through the onclick event of an HTML "play" button.. Here is my page:
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<title>AJA Ki Pro</title>
<link href="css/index-iui.css" rel="stylesheet" type="text/css" media="screen" />
<!-- <script type="text/javascript" src="js/kipro.common.js"></script> -->
<!-- <link rel="shortcut icon" href="/favicon.ico?" type="image/x-icon"/> -->
<script type="text/javascript">
function play(){
var cmdPlay = new XMLHttpRequest();
cmdPlay.onreadystatechange = function() {
if (cmdPlay.readyState == 4 && cmdPlay.status == 200) {
var result = cmdPlay.responseText;
}
};
cmdPlay.open("GET", "C:/wamp/cgi-bin/kipro/play.py", true);
cmdPlay.send();
}
</script>
</head>
<body style="overflow: hidden; background-color: #000000;" orient="landscape">
<form id="home" class="dialog" selected="true" action="">
<!-- <a class="button blueButton" type="cancel">Close</a> -->
<div id="player" class="transportPlayer">
<div id="transport_display" class="transportDisplay">
<div id="clip">Clip
<div id="eParamID_CurrentClip" data-paramid="eParamID_CurrentClip" class="eParamID_CurrentClip element_text polling_frequency_1" style="display: inline;">
</div>
</div>
<div id="media_stats">
<div id="eParamID_SelectedSlot" class="element_text polling_frequency_5" style="display: inline;">
</div>
<div id="media_info_controls_page" class="available_media_info">
<div id="eParamID_CurrentMediaAvailable" class="element_text polling_frequency_9" style="display: inline;">
</div>%
</div>
</div>
<div id="reel">Reel
<div id="eParamID_VolumeName" class="element_text polling_frequency_5" style="display: inline;">
</div>
</div>
<div id="timecode">
<div id="eParamID_DisplayTimecode" class="element_text">
</div>
</div>
</div>
<!-- <div id="transport_buttons" class="transportButtons"> -->
<div id="reverse" class="transportButton reverseButton"></div>
<div id="play" class="transportButton playButton" onclick="play()"></div>
<div id="forward" class="transportButton forwardButton"></div>
<div id="stop" class="transportButton stopButton"></div>
<div id="record" class="transportButton recordButton"></div>
<div id="select_up" class="transportButton selectUpButton"></div>
<div id="select_down" class="transportButton selectDownButton"></div>
<div id="delete_clip" class="transportButton deleteClipButton"></div>
<!-- </div> -->
<div id="kipro_transport" class="kiproLogo"></div>
</form>
</body>
</html>
If I double click the python script directly it does work and a "play" command is issued to the target machine... and it plays
Any help is appreciated as I am just learning python.
Thanks,
Ken