#Pass stdin to OS.execute() call?
1 messages · Page 1 of 1 (latest)
You can find it in the documentation.
Just pass a String Array as the second argument
https://docs.godotengine.org/de/4.x/classes/class_os.html#class-os-method-execute
Inherits: Object Provides access to common operating system functionalities. Description: The OS class wraps the most common functionalities for communicating with the host operating system, such a...
Aren't those the args for the program rather than the stdin for it?
Ah. It is slowly dawning on me now ... follow up question, then; how do I safely navigate to user://?
I was just about to answer how to send an stdin input to the program. I'm guessing you have that side figured out then?
I think so. I run "CMD.exe", and then my args concern what CMD is to do ... so when I get to where the program is supposed to be, I write the arguments out.
I had originally the path set to "user://program_folder/program.exe", but that was obviously wrong.
For your other question, there is a function in OS for getting the user:// called get_user_data_dir()
ah, so I can use that to generate the cd call in the array 🙂
Exactly, yeah.
Thanks a bunch. Will try it out now 🙂
What is the "C/" for at the beginning of args?
It's a command that tells command prompt "Run whatever comes after this, and then close." It's how you tell it to do something, rather than just opening and waiting for input from the user.
There's more in depth documentation here: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cmd
It's a command prompt specific thing rather than a godot thing.
Thanks again for this! Excellent help 🙂 OS.execute now returns 1, so it seems to work - the text-to-speech program on the other end, however, does not produce the file it would normally. Another puzzle 🙂