|
3 registered members (TipmyPip, clint000, Grant),
6,810
guests, and 4
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: windows cmd interaction
[Re: muffel]
#345439
10/26/10 10:16
10/26/10 10:16
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
OP
Expert
|
OP
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
Okay, maybe I'm not being clear enough. Sorry. I DID get acknex to log back to a console, and making it read from the console is not the trouble either. All your examples do exactly that, which is a start.
What I want to achieve is more. I want to publish the script and then call the created .exe from a cmd.exe command. So in the console I type: H:\Artwork\3dgs\Test\ConsoleOutput\Consoleoutput.exe
Now, when doing this, all of your examples create a new console which the program can then interact with. Here's the trouble: our goal is to call the published .exe accross the network, and thus run it on a remote PC. Now if I use allocConsole, it creates a new console on that remote PC, which we cannot view unless we install and use a programm like TeamViewer, which totally defeats the purpose. So, instead, we want the program to log back into _the cmd.exe instance_ that calls it.
That's the reason I asked here, and not in my original thread, because I figured jcl would know best what his engine does with stdout and stdin. I am unsure as to whether redirecting stdout will do it, but that's what I'm trying to achieve.
Hope I was clearer now?
Thank you for the code examples, but they just write to a newly allocated console, not to the calling console.
Edit: I understand the name for what I want to do is "piping". Maybe I am wrong in thinking that something like that already exists automatically between a cmd.exe that calls an acknex application. I thought this was the case and was "stopped" by acknex printing to the acknex starter window/acklog.txt instead.
Last edited by Germanunkol; 10/26/10 10:37.
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: windows cmd interaction
[Re: Germanunkol]
#345442
10/26/10 10:48
10/26/10 10:48
|
Joined: Oct 2007
Posts: 5,211 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,211
İstanbul, Turkey
|
2 options, develop a rcon app, that connects like a client to your server but can run commands on your server, you can also add a rcon in-game that authorized users can run server commands without leaving the game, that's what games like half-life does. It may not have to be an app if you use sockets and such, but it may also not be as convenient.
otherwise, you can move your server to c++ with engine sdk, in which you already have the console counterpart of the app you want.
3333333333
|
|
|
Re: windows cmd interaction
[Re: Germanunkol]
#345505
10/26/10 23:21
10/26/10 23:21
|
Joined: Oct 2004
Posts: 900 Lgh
rojart
User
|
User
Joined: Oct 2004
Posts: 900
Lgh
|
My problem is that what I find from google is that printf is supposed to write back to the console, but printf is caught by the acknex startup window. Do you know if acknex redirects "STDIN" and "STDOUT"? Because from what I gather, by default, these are set to the calling console. But I might be wrong. Have you tried using a sys_message function, printf instead? I got to work with it, like this simple example:
int main(){
exec("c:\\windows\\system32\\cmd.exe",NULL); wait(-3);
while(!sys_active("c:\\windows\\system32\\cmd.exe"))wait(1);
sys_message("dir[Enter]");
}
Make sure that the cmd.exe is located in the same directory path "c:\\windows\\system32\\cmd.exe", usually by default.
|
|
|
Re: windows cmd interaction
[Re: rojart]
#345582
10/27/10 18:02
10/27/10 18:02
|
Joined: Jun 2006
Posts: 2,640 Earth
Germanunkol
OP
Expert
|
OP
Expert
Joined: Jun 2006
Posts: 2,640
Earth
|
Again, I don't want to execute a new console and talk to it: I've done that. I want to talk back to the console that was used to exec the engine.
~"I never let school interfere with my education"~ -Mark Twain
|
|
|
Re: windows cmd interaction
[Re: Germanunkol]
#345602
10/27/10 19:59
10/27/10 19:59
|
Joined: Oct 2004
Posts: 900 Lgh
rojart
User
|
User
Joined: Oct 2004
Posts: 900
Lgh
|
Yes, my fault, but should it work in both directions. Just comment out the exec function. Publish the code below and run it with cmd.exe Then you get exactly that what you need, maybe. Make sure, that the cmd.exe window is active.
int main(){
//exec("c:\\windows\\system32\\cmd.exe",NULL); wait(-3);
while(!sys_active("c:\\windows\\system32\\cmd.exe"))wait(1);
sys_message("cd /..[Enter]");
sys_message("cls[Enter]");
sys_message("dir[Enter]");
}
|
|
|
|