ID:1290610
 
(See the best response by Pirion.)
Code:
shell("\"C:\\Program Files (x86)\\BYOND\\bin\\dm.exe\" > [src.Environment]")


Problem description:
I want to get the compile result from dm.exe I have tried so many ways but nothing happens except dm.exe running and it doesn't even recognize the environment, how can I send the result of the compile to a text file? Can someone help? Thanks in advance.

[src.Environment] is the .dme file which the user uploads at the beginning of the game.


shell("\"C:\\Program Files (x86)\\BYOND\\bin\\dreammaker.exe\" > [src.Environment]")
src << file2text("[src.Environment]")


I'm pretty sure you just use the file2text process on the file. I could be wrong, but that's my guess. (I can't test it, so you'll have to try it for yourself. Though, it might be possible you'll have to check after compiling the file, instead of finding the Environment and then using that. Honestly, I can't say, I'm not using shell() very often.)
This just outputs the content of my environment. I'm trying to have it compile and send the result (0 errors,0 warnings).

Any help anyone?
The correct systax of the command would be:

shell("\"C:\\Program Files (x86)\\BYOND\\bin\\dreammaker.exe\" [src.Environment] > output.txt")
src << file2text("output.txt")


I tested this when I was speaking to Kidpaddle last night, and the redirect operator to redirect the output to a file did not work when using shell for me.

I did post a bug report at that time. [Link]

No file appear for me either...+ It seems that dm.exe only launch as if no environment was sent to it.(It only shows h-for help,o-for object tree...) but doesn't show any compiling results.
In response to Kidpaddle45
That fine man up there used dreammaker.exe and you dare to test with dm.exe?!
Using Dream Maker won't do anything.
dragging a file into dm.exe auto compiles it. What I'm looking to do, is compile and get the result within the game without running dream maker and having it compile.

In response to Kidpaddle45
Kidpaddle45 wrote:
Using Dream Maker won't do anything.
dragging a file into dm.exe auto compiles it. What I'm looking to do, is compile and get the result within the game without running dream maker and having it compile.


Quick question, you're testing this on a Linux system, right? Because the file writer ">" doesn't work on windows.
No, I'm using Windows. o.o
In response to Kidpaddle45
That's why it doesn't work. Problem solved.
Arghh Is there any way , I could do this on Windows?
In response to Kidpaddle45
Not to my knowledge. Try searching for the windows version of ">", should be something like WriteFile
Alright, thanks for the help.
Hmm, you sure about the ">" not working on Windows?
I just found this and it works for commands prompt on windows.
http://www.microsoft.com/resources/documentation/windows/xp/ all/proddocs/en-us/redirection.mspx?mfr=true
">" does work on Windows, though? I think I'm missing something.

Sorry - I didn't even check the application you had listed; it does need dm.exe to compile. Argument is the .dme file to compile.


Either way, the issue is present. :(

I used 'dir > out.txt' as a test case. It works in cmd.exe and not in shell().
Best response
Unable to edit.

Tom updated the bug report, apprently need to use cmd /c [cmd] in order to access pipe and redirect using shell - and it will be updated in reference.

For completeness - here is the code to compile in dream seeker, with output.

proc/Compile(Environment)
if(Environment && Environment != "")
shell("cmd /C \"\"C:\\Program Files (x86)\\BYOND\\bin\\dm.exe\" \"[Environment]\"\" > .compile")
world << file2text(".compile")
In response to Pirion
Pirion wrote:
Unable to edit.

Tom updated the bug report, apprently need to use cmd /c [cmd] in order to access pipe and redirect using shell - and it will be updated in reference.

For completeness - here is the code to compile in dream seeker, with output.

> proc/Compile(Environment)
> if(Environment && Environment != "")
> shell("cmd /C \"\"C:\\Program Files (x86)\\BYOND\\bin\\dm.exe\" \"[Environment]\"\" > .compile")
> world << file2text(".compile")
>
>


Actually worked. Great find on that DM Reference mistake xD
Thanks again Prion. =D