Gamestudio Links
Zorro Links
Newest Posts
Zorro version 3.0 prerelease!
by Grant. 02/24/26 22:21
WFO Training with parallel cores Zorro64
by Martin_HH. 02/24/26 19:51
ZorroGPT
by TipmyPip. 02/23/26 21:52
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (TipmyPip, clint000, Grant), 6,810 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
alx, ApprenticeInMuc, PatrickH90, USER0328, Sfrdragon
19199 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
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 Offline OP
Expert
Germanunkol  Offline 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 Offline
Senior Expert
Quad  Offline
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 Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
Originally Posted By: Germanunkol
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:

Code:
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.




Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P
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 Offline OP
Expert
Germanunkol  Offline 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 Offline
User
rojart  Offline
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.

Code:
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]");
}





Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P
Re: windows cmd interaction [Re: rojart] #345758
10/29/10 13:19
10/29/10 13:19
Joined: Jul 2000
Posts: 28,075
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,075
Frankfurt
The sys_message function should work when the console is ready to accept input at that moment. The printf function won't work for a console - it is not the standard Windows printf function, but a lite-C specific function that opens a message box or prints to the engine window.

Page 2 of 2 1 2

Moderated by  old_bill, Tobias 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1