We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have a shell script that returns settings from my camera. The script works as I think it should when I run it from terminal, but when I run the following app from processing I'm not able to see any of the information come back:
import java.util.*;
import java.io.*;
void setup() {
size(480, 120);
camSummary();
}
void draw() {
}
void camSummary() {
String commandToRun = "./ex2.sh";
File workingDir = new File("/Users/lorenzimmer/Documents/RC/CamSoft/");
String returnedValues; // value to return any results
try {
println("in try");
Process p = Runtime.getRuntime().exec(commandToRun, null, workingDir);
int i = p.waitFor();
if (i==0) {
BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
while ( (returnedValues = stdInput.readLine ()) != null) {
println(returnedValues);
}
}else{
println("i is: " + i);
}
}
catch(Throwable t) {
println(t);
}
}
Eventually I would like to read some of the data from the script into variables and then use those variables in processing. I've also tried to have the script read the information into a text file, when I ran the processing app the text file came back blank even thought the script would generate text when executed from terminal.
Could someone help me sort this out?
Thank you,
Loren