We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
Page Index Toggle Pages: 1
puredata export? (Read 580 times)
puredata export?
Apr 10th, 2008, 3:34pm
 
can any PD folk tell me: is there a way in PD to export a patch as an application?

basically i'm using OSC to connect PD to processing and i'd like processing to be the only thing i have to open up, then have it automatically open up the right patch in PD. so i figured if i can export my PD patch as an "application" somehow, then i could get processing to launch it automatically.

thanks....
Re: puredata export?
Reply #1 - Apr 10th, 2008, 8:03pm
 
Hi,

You don't need to export it as an app. You can launch it from Java. I've used this code in a project:
Code:

package org.jorgecardoso.pso;
import java.io.*;

public class LaunchPD {

Process process;
Runtime runtime;

String cmd;

public LaunchPD(String cmd) {
runtime = Runtime.getRuntime();
this.cmd = cmd;
}


public void start() {
try {
process = runtime.exec(cmd);
} catch (IOException ioe) {
System.out.println(ioe.getMessage() + " " + cmd);
}

}


public void stop() {
if (process != null) {
process.destroy();
}
}



// Test

public static void main(String args[]) {

LaunchPD lpd = new LaunchPD("../pd/bin/pd.exe -nogui -lib zexy -lib oscx");



lpd.start();
try {
Thread.sleep(5000);
}catch (InterruptedException ie) {
System.out.println(ie.getMessage());
}


lpd.stop();

}
}



jorge
Re: puredata export?
Reply #2 - Apr 11th, 2008, 1:28am
 
thanks looks like it should work nicely for what i want.

haven't got it to work yet though (i'm on a mac) using this (returns a "cannot execute" error):

Code:

LaunchPD lpd = new LaunchPD("../../Applications/Pd-extended.app");


any idea what i need to do differently on a mac?

(and ultimately i would like to do something like this:

Code:

LaunchPD lpd = new LaunchPD("../../Applications/Pd-extended.app -nogui -open /path/to/my/file");


(btw, i also tried

Code:

String[] params = { "../../Applications/Pd-extended.app" };
open(params);


which opened up pd correctly, but if i added parameters:

Code:

String[] params = { "../../Applications/Pd-extended.app","-open path/to/my/file" };
open(params);


it failed to open anything (though with no error)


Page Index Toggle Pages: 1