FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   apps talking to each other (through txt file)
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: apps talking to each other (through txt file)  (Read 556 times)
mattgilbert

tangramkid WWW Email
apps talking to each other (through txt file)
« on: Jul 5th, 2004, 10:56pm »

Hi all,
 
I've made a sketch pair to see how two apps can talk to each other by saving and reading a text file.
 
My reason for doing this is to try to figure out a temporary work-arround for this bug on MacOSX: http://processing.org/discourse/yabb/board_Proce55ing_software__bugs_action_display_num_1076679293.html
 The idea being that I make one app that listens to serialEvents and saves that data to a file, while the other app reads that file and controls sound with that data, since the bug prevents an app from keeping track of serial while making sounds.
 
If anyone has a better way of having apps talk to each other, then ignore the rest of this post and just tell me that, if you will.
 
Ben Fry's recently posted work-around for exporting programs (http://processing.org/discourse/yabb/board_Tools_action_display__num_1086874853.html) was used. (thx again, ben!)
 
Some notes about the programs before I give the download link:
 
The original goal was to have the mouse position in one app reflected in the window of the other app, but when i tried that, the receiving app usually/eventually froze. So now it works off of clicks instead. Ideally this would work really fast, though, if it's to follow serial data in real time.
 
It's a bit cumbersome to use, but the point is illustrated.
 
First click on AppTalkSend.
Then click on AppTalkReceive. The position of the click on AppTalkSend should determine the position of the crosshairs in AppTalkReceive.
 
What's cumbersome about it is that clicking on AppTalkSend once often gives the wrong click position for the cursor. However, after this first click has given the app focus, subsequent clicks will give an accurate position to the crosshairs, given that the click is in a different spot.
 
Here's a zip file with the 2 MacOSX apps and the source code:
 
www.mattgilbert.net/AppTalkTry.zip
 
fjen

WWW
Re: apps talking to each other (through txt file)
« Reply #1 on: Jul 16th, 2004, 9:21pm »

why not have the two apps talk via net? here's an example:
http://www.florianjenett.de/p55/talkingApps.zip
« Last Edit: Jul 18th, 2004, 11:35am by fjen »  
mattgilbert

tangramkid WWW Email
Re: apps talking to each other (through net stuff)
« Reply #2 on: Jul 18th, 2004, 12:01am »

thank you for the reply!
 
however i can't get your examples to work. it may be another problem with OS X, which I'm using.
 
When I try to export, I get an OutOfMemoryError, which doesn't seem like it should happen with such small applets.  
 
When I try to run one in a processing window, it doesn't recognize the "beginNet" and "netWrite" methods. Are these a part of a library somewhere that I don't have?
 
When I try to package up the already exported (?) stuff included in the download in the way laid out in ben fry's exporting to application technique posted not too long ago, the resulting program won't open.
 
As a sidenote, the URL you posted didn't work, but it did after I removed the "ftp." from it.
 
Confused, but thrilled that someone has helped,
 
Matt
 
 
fjen

WWW
Re: apps talking to each other (through net stuff)
« Reply #3 on: Jul 18th, 2004, 11:47am »

on Jul 18th, 2004, 12:01am, mattgilbert wrote:
When I try to export, I get an OutOfMemoryError, which doesn't seem like it should happen with such small applets.

i'm on os-x too. i get that from time to time as well .. normaly quitting and reopening processing does the job.
 
on Jul 18th, 2004, 12:01am, mattgilbert wrote:
... doesn't recognize the "beginNet" and "netWrite" methods.

which version of processing are you using maybe you should download the newest. i'm not sure when beginNet & netWrite were introduced ...
 
on Jul 18th, 2004, 12:01am, mattgilbert wrote:
When I try to package up ... the resulting program won't open.

hmm. did you "chmod +x" on it
anyway you can start my exported version via terminal (as i do) ..
Code:
cd <your-way-to-p5-folder>/sketchbook/default/talkingAppsServer/applet/talkingAppsServer

then
Code:
java talkingAppsServer

and the same for talkingAppsClient (start server first)
 
i cleaned the code in talkingApps.zip a little ... maybe you wanna download it again (i repaired the link above).
« Last Edit: Jul 18th, 2004, 12:39pm by fjen »  
mattgilbert

tangramkid WWW Email
Re: apps talking to each other (through txt file)
« Reply #4 on: Jul 22nd, 2004, 8:56am »

it turns out that, for me, your examples work when exported and packaged from Processing 68, but not 69. They open fine from the sketch window in 68 too, which would pass errors saying it couldn't find the methods "netWrite" or "beginNet" in 69.
 
Anyway, i got your examples to work! This should be hugely helpful, so thanks so much!
 
Regarding the net stuff not working in 69 for me: I didn't find an explanation of this in the revisions.txt file; Is this a common issue or just a problem for me? Are they or have they phased out the net stuff (for the meantime)?
 
Matt
 
 
« Last Edit: Jul 22nd, 2004, 8:59am by mattgilbert »  
fry


WWW
Re: apps talking to each other (through txt file)
« Reply #5 on: Jul 23rd, 2004, 5:08pm »

hm, a quick glance at 69 for the mac makes it look as though net was dropped.. that was unintentional. net was in bad shape and mostly unusable, but we'll have a new version out with megabucket.
 
Pages: 1 

« Previous topic | Next topic »