2 registered members (AndrewAMD, TedMar),
1,031
guests, and 1
spider. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Change in the exec command
#117753
03/17/07 00:16
03/17/07 00:16
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
OP
Expert
|
OP
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
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
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Change in the exec command
[Re: Uhrwerk]
#117754
03/17/07 14:34
03/17/07 14:34
|
Joined: Oct 2003
Posts: 1,258 Virginia, USA
qwerty823
Senior Developer
|
Senior Developer
Joined: Oct 2003
Posts: 1,258
Virginia, USA
|
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.
Never argue with an idiot. They drag you down to their level then beat you with experience
|
|
|
Re: Change in the exec command
[Re: qwerty823]
#117755
03/17/07 15:32
03/17/07 15:32
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
OP
Expert
|
OP
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
That doesn't run on my mashine. Neither Code:
exec("start","test.pdf");Code:
nor
Code:
exec("start","C:\test.pdf");
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Change in the exec command
[Re: Uhrwerk]
#117756
03/18/07 01:53
03/18/07 01:53
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
@Zeitwork... I havn't tried it, but Querty823 didn't use a comma as you did, but instead, passed it along in the string...
xXxGuitar511 - Programmer
|
|
|
Re: Change in the exec command
[Re: xXxGuitar511]
#117757
03/18/07 16:00
03/18/07 16:00
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
OP
Expert
|
OP
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
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.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Change in the exec command
[Re: xXxGuitar511]
#117759
03/22/07 08:08
03/22/07 08:08
|
Joined: Jun 2003
Posts: 1,017 Germany
Thomas_Nitschke
Senior Developer
|
Senior Developer
Joined: Jun 2003
Posts: 1,017
Germany
|
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.
Formerly known as The Matrix - ICQ 170408644
I've been here for much longer than most people think. So where's my "Expert" status?
|
|
|
Re: Change in the exec command
[Re: Thomas_Nitschke]
#117760
03/22/07 13:16
03/22/07 13:16
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
OP
Expert
|
OP
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
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.
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: Change in the exec command
[Re: Uhrwerk]
#117761
03/24/07 22:04
03/24/07 22:04
|
Joined: Jun 2003
Posts: 1,017 Germany
Thomas_Nitschke
Senior Developer
|
Senior Developer
Joined: Jun 2003
Posts: 1,017
Germany
|
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.
Formerly known as The Matrix - ICQ 170408644
I've been here for much longer than most people think. So where's my "Expert" status?
|
|
|
Re: Change in the exec command
[Re: Thomas_Nitschke]
#326196
05/31/10 01:29
05/31/10 01:29
|
Joined: Jul 2004
Posts: 1,710
MMike
Serious User
|
Serious User
Joined: Jul 2004
Posts: 1,710
|
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.
|
|
|
|