Hi there, having a bit of an issue with a sketch I'm working on at the moment. I'm currently trying to get Processing to call Terminal to read a txt file and execute its contents. Ideally, Terminal would write the resultant data to another txt file, which my Processing sketch could then access.
I found these lines of code on an old forum post:
void mousePressed() {
String[] params = {"drutil", "tray", "eject","disk0s2" };
exec(params);
}
While near the mark, the same format doesn't seem to apply to reading and executing a txt file:
void mousePressed() {
String [] params = {"source", "parserrun.txt"} ;
println(params);
exec(params);
}
More info here:
http://processing.org/reference/open_.html
http://processing.org/discourse/beta/num_1237204442.html
In the disk example they use exec, but it appears there's a difference between using exec and open that I'm not aware of.
The documentation says: "For users familiar with Java, this is not quite the same as Runtime.exec(), because the launcher command is prepended. Instead, the exec(String[]) function is a shortcut for Runtime.getRuntime.exec(String[]). "
I'd greatly appreciate any advice. Cheers.