Communication between apps

Is there a way of passing data between apps in Processing, such as OLE ?

1 Like

You could use the OscP5 lib. However, it only works in one direction. If you run the code below in two sketches on the same PC, with the remoteLocation being the IP of the PC, the second sketch that will be started takes the lead and sends messages to the first one.

import oscP5.*;
import netP5.*;

OscP5 oscP5;
NetAddress remoteLocation;
int x, y;

void setup() {
  size(400, 400);
  oscP5 = new OscP5(this, 12000); 
  remoteLocation = new NetAddress("192.168.25.5", 12000); // 192.168.25.4 has to be the IP of the other phone/PC
  fill(0);
}

void draw() {
  background(255);  
  ellipse(x, y, 10, 10);
}

void oscEvent(OscMessage m) {
  // if(m.checkAddrPattern("/tes") == true) {
  //  if(m.checkTypetag("ii")) { 
  x = m.get(0).intValue(); 
  y = m.get(1).intValue();
  // }  
  //}
}

void mouseDragged() {
  oscP5.send("/tes", new Object[] {new Integer(str(mouseX)), new Integer(str(mouseY))}, remoteLocation);
}

/*
 Address patterns in the OSC protocol are used as "labels" to switch/direct easily to different functions
 using "checkAddrPattern(/yourLabel)"
 The typetag is actually a string containing the order and amount of data types that you use in 
 the Object[] parameters. For instance; "ifs" means three parameters in object respectively, int, float, and string 
 */
1 Like

Its not OLE but I have used this to talk between apps across the planet.

Examples in Processing IDE:
image

:)

1 Like

Thanks for that suggestion. Guess I gotta go read up on OSC, whatever that is :slight_smile:

Thanks also for the networking suggestion.
Seems I wasn’t totally clear i my request, though: only one of the apps is a Processing app, the other is an in house app that could be adapted, if I know what Processing will support.

Just curious; the other would be in what language?

Good question, but actually I don’t know: it was written by a different division of the company. I’ll find out. Did you have something in mind that prompted the question?

Hehe, your answers leave more questions. Anyways everything is going mobile, and Android is, I believe, winning over IOS because of freedom when implementing IOT

Oh, there’s nothing mysterious or even mildly exciting, really :slight_smile: My request has nothing to do with mobile or IOT. it’s just that I want to extract some continuous data from an industrial data gathering tool and send it to a visualizer (graphic display) written in Processing. Both apps run on a Windows box.

1 Like

oscP5 should be perfect for that.

http://www.sojamo.de/libraries/oscP5/

You can send or receive or both, but it sounds like your Processing sketch will just be a receiver.

It comes bundled with examples, and you can test the sending end with a second sketch to work out exactly what you want your tool will need to send.

Thanks for the reply, Jeremy. Yes, in this initial case the Processing sketch will be receiving data, but my intention is eventually to send data back, if the stage one project is successful.
I’ll go look up oscP5, run a couple of examples, and see how much trouble I can get myself into :wink:
I hope you don’t mind if I come back and ask for help if I get lost!

1 Like