Using the launch() function does launch the already compiled sketch. But the compiled sketch ends/exits immediately. I wasn’t sure launch() was working until I set the flag in the properties of the compiled sketch to “Run as Administrator”. The usual alert popped up asking if I want to allow the app to make changes to my device. I click “Allow” and the compiled sketch starts and shuts down in a blink. I can run the compiled sketch no problem, but not from within a sketch.
Anyone experiencing this?
Any thoughts?
Thanks
I’m using Processing 4. I created a new sketch just to launch() a exported sketch(.exe file). I used a different compiled sketch than the one I previously tried and received the same results.
After further checking, I found the launch() function will launch, say “C:\Windows\System32\notepad.exe”, but will not launch any of the exported sketches (“.exe” files) I created.
I’m hoping to find an answer to this anomaly
Any thoughts would be appreciated
Hi @markcosmic,
you need to be in the same directory as the executable, resp. the working directory needs to be set to.
So on windows you can call it like that …
launch("cd /d <drive>:<path_to_sketch_exe> && <executable_name>.exe");
This should work. If not, you can trace the issue by using
Process p = launch("cd /d <drive>:<path_to_sketch_exe> && <executable_name>.exe");
try {
p.getErrorStream().transferTo(System.err);
} catch (Exception e) {
println("Error on Stream: " + e)
}
Cheers
— mnse
PS: remember to use \\
for \
on path string. ie: cd C:\\MyDir\\etc\\
mnse,
Thank you for responding. I am aware of the launch(parameters).
This is what I tried:
case 5: //launch Create PlayList
//createPlayList(); (this links the ChatGPT suggested way to do it)
//launch(“C:\Windows\System32\notepad.exe”); //THIS WORKED
Hi @markcosmic,
Please read my post carefully to get the point.
If you start notepad.exe you are not dependent of a working dir. This is different for starting the sketch executable.
Cheers
— mnse
Thank you. I got it. This is what worked for me. I didn’t want to hard code a location.
launch(“cd /d” + dataPath(“&& PlayList03.exe”));
Again,
Thank you