On January 8, 2012 at 19:50, Guy Palmer said...
I am finding it difficult to say anything useful because I simply don't understand your code.
I understand from your response that I’m using incorrect syntax i.e :-
CF.widget("KeyA", "Unshifted").scheduleActions(TCPCommand ("chars:Not Shifted !"));
And it should look more like:-
With the actions added to the button I’m using (KeyA) which is placed on another page (Unshifted).
TCPCommand is a function created to send text to a socket. I tried to put the above “function command” example directly on “KeyA” (on the page named “Unshifted”) but it would not work. Hence how I came about using the incorrect code I used, as it did appear to send the command ok. Having given this some more thought I was wondering if its not working due to the code for the TCPCommand function is on another page i.e. “Activity Properties”?
Here is the code used on "Activity Properties:-
var keyboardState = 0;
// Define variables
var Target_PC = CF.widget("Remote_PC_IP_Address", "PARAMETERS").label
var Target_Port = CF.widget("Remote_PC_PORT", "PARAMETERS").label
var return_data = "";
var Remote_PC_Socket = new TCPSocket(false);
// Write log if failure
Remote_PC_Socket.onIOError = function(e)
Diagnostics.log("Remote_PC_Socket failure: " + e);
// Capture return data
Remote_PC_Socket.onData = function()
return_data += read();
// Initialize Socket
Remote_PC_Socket.onConnect = function()
// Connect to socket
Remote_PC_Socket.write(command + "\r\n");
I’m currently lost and think I need to go back to the beginning and have a re-think!
My goal is to have an onscreen keyboard (talking to Media Center PC) on an overlay which can send both TCP/IP commands if a socket is connected else fall back to Media Center IR commands. Hence I need two commands on each keyboard button.