We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Can somebody help me with this? I need to do this project fast, but it won't work like the example in the open() reference on the Processing site. So it says there that to write a command in the windows cmd, I first need to open it with open(cmd/c); and after that to put a string array consisting of one command or more to be executed in the cmd, but it simply doesn't work, and I don't get it why... can someone give me a test program consisting the command "ping www.google.com > test.txt" please? It just wouldn't work at me. The program executes, I press in the program window with my mouse ( the open() and the other instructions are found in void mousePressed() ) and when I check the test.txt, it doesn't appear anything but blank. Please, I really need this get working!
Answers
Yes. Show some code, dude.
Is that windows?
It won't work in browser
What about /c
?
;-)
Yes, I am in windows, and I tried like a hundred options to write it in different ways, including this. I think I need to add that I put my program in the system32 folder in windows.
void setup() { size(200, 200); }
void draw() { background(0); }
void mousePressed() { String[] params = { "cmd.exe", "ping wwww.gogole.com > test.txt" }; open(params); }
Ok, the alignment is messed up but I think you can understand it, it's short and simple...
open() reference:
So the cmd.exe part is redundant. And you put too much info in one string, you must split it, as stated.
I don't recall exactly, but I don't think that redirection, pipes and the like work there.
you look here pls
http://www.processing.org/reference/libraries/net/index.html
Of course, you can make a little .cmd (or .bat) file that holds your command with redirection, and run it instead.
I Think I will go with the .bat file idea, sounds good. Thank you!