Change in the exec command

Posted By: Uhrwerk

Change in the exec command - 03/17/07 00:16

Until now the exec command can only execute executable files, i.e. Applications or batch commands. Could you change the implementation of exec to a simple call of the windows API function ShellExecuteEx or ShellExecute? That was only a minor change but would enable us to open arbitrary document types within the games folder.

Regards, Zeitwerk
Posted By: qwerty823

Re: Change in the exec command - 03/17/07 14:34

I'm pretty sure (though haven't tried it recently) that you can use the "start" command to open docs, etc, if need be.

Not tested (and not looking at my reference), you should be able to do:

exec("start document.txt");

And that should launch "notepad.exe" or whatever the user has configured for txt files.
Posted By: Uhrwerk

Re: Change in the exec command - 03/17/07 15:32

That doesn't run on my mashine. Neither
Code:
exec("start","test.pdf");Code:

nor

Code:
exec("start","C:\test.pdf");
Posted By: xXxGuitar511

Re: Change in the exec command - 03/18/07 01:53

@Zeitwork... I havn't tried it, but Querty823 didn't use a comma as you did, but instead, passed it along in the string...
Posted By: Uhrwerk

Re: Change in the exec command - 03/18/07 16:00

From the manual:
Quote:

exec (STRING* program, STRING* options);
Executes an external program or batch file.
Parameters:
program - file name of the exe or batch file.
options - command line parameter to be passed to the program.




However, I have even tried it the way you described it. Didn't work.
Posted By: xXxGuitar511

Re: Change in the exec command - 03/19/07 14:54

oh, sorry...
Posted By: Thomas_Nitschke

Re: Change in the exec command - 03/22/07 08:08

Why not use a batch file...
Code:

@echo off
cls
start %1
exit



In A6, use:
Code:

exec( "thebatchfile.bat","yourfile.pdf" );



IMHO this should work.
Posted By: Uhrwerk

Re: Change in the exec command - 03/22/07 13:16

This would work, yes. But the console windows tend to stay open. And a lot of console windows remaining, when the game is ended look amateurish.
Posted By: Thomas_Nitschke

Re: Change in the exec command - 03/24/07 22:04

I agree totally. However, as far as I am concerned, a batch file using the "start" command will not wait for the started task to finish, thus the window should theoretically not stay opened.
Posted By: MMike

Re: Change in the exec command - 05/31/10 01:29

well they should add.. the HIDE option ..

Its sooo easy.. because this is comming from the

#include <windows.h>
long WINAPI ShellExecute(long hwnd ,long lpOperation ,long lpFile ,long lpParameters ,long lpDirectory ,long nShowCmd);

and then calling
ShellExecute(NULL,"OPEN","bla.txt","-parameters",NULL,SW_HIDE);

ANd your done.. you have no console at all..
the only thing is that i dont know how to wait to the thing to return.
Posted By: jcl

Re: Change in the exec command - 05/31/10 11:55

Again you seem to be a little late with your suggestion wink.

http://manual.3dgamestudio.net/ain-exec.htm
Posted By: MMike

Re: Change in the exec command - 06/01/10 02:30

again?
i dont understand?
i dont mean the feature it self! because that one ( the exec command) i already knew..

Im just telling that there could be an add to it, to let us hide the command console...
like i did above with the SW_HIDE
which is not on the manual at least saying... you can hide the console
ps: if you mean the wait, "the only thing is that i dont know how to wait to the thing to return."

i was refering to the ShellExecute... because i prefer to use the shellexec (with the hiding option) instead of the exec, but i dont know how to wait to return, when using such command.

Posted By: Spirit

Re: Change in the exec command - 06/01/10 07:23

Indeed it's already there! I had not noticed it until now.
Posted By: MMike

Re: Change in the exec command - 06/01/10 14:36

Spirit, but whats there??
Posted By: jcl

Re: Change in the exec command - 06/01/10 15:48

The exec function does exactly what Uhrwerk wanted. In fact it uses ShellExecute.

I do not mind when old features are requested, but it's sort of more useful to request new features.
© 2024 lite-C Forums