Your Universal Remote Control Center
Philips Pronto Professional Forum - View Post
Up level
Up level
The following page was printed from


Original thread:
Post 5 made on Thursday July 9, 2020 at 16:13
Lyndel McGee
RC Moderator
August 2001
Here is an example that should work. I think your code above works but note that \x0D and \r are identical and you are sending 2 carriage returns with each command that does nothing except to cause extra processing on the receiver's end.

Put all this code into the Activity Script.


var socket;
var buffer = "";
var CR = "\r";

function onSocketConnect() {
// once connection is established, you can write anything
// write is not done here as we want to send commands based on button presses.
// sendCommand("!1MVLUP");

function onSocketData() {
var temp,first;;
// here, you have to use substring, split, or other methods to get actual messages.
// assuming that each response is delineated by a carriage return \r or \x0d, you can do the following:
first = buffer.indexOf(CR);
while (first >= 0) {
// do something with the data - extract first message up to but on including CR.
temp = buffer.substring(0, first);
buffer = buffer.substring(first + 1);
// find next CR.
first = buffer.indexOf(CR);

function onSocketIOError(e)
System.print("sock IO Error error:" + e);

function notifyMessageReceived(message) {
// message will not have the terminating \r as it was stripped of as the message delimiter.

function closeSocket() {
if (socket) {
if (socket.connected) socket.close;
socket = null;

function resetSocket() {
// if currently connected, clean things up.
// create asynchronous socket.
socket = new TCPSocket(false);
// reset buffer clearing any data from previous socket.
buffer = "";

// assign callbacks for connect, data received, and ioError.
socket.onConnect = onSocketConnect;
socket.onData = onSocketData;
socket.onIOError = onSocketIOError;

function sendCommand(command) {
if (socket) socket.write(command + CR);

// create a new socket and connect
// request connect to IP, port with a timeout

Put this code into a button you create on a page in the same activity.


On the same page, create a panel with ProntoScript Name of "_PS_DEBUG_" so you can see the output. See section 14.1 of the ProntoScript Dev Guide 1.4.3 from here [Link:]
Lyndel McGee
Philips Pronto Addict/Beta Tester

Hosting Services by ipHouse