execfile

Blitz3D Forums/Blitz3D Programming/execfile

cash(Posted 2007) [#1]
Just a quick question....

When I call an exe file with the execfile comand it all works great.

However what I really want to do is end the program calling once the new exe is called.

I tried

execfile <myfile.exe> : end

But it still leaves the file running...Its gotta be simple and maybe not in the correct forum....


b32(Posted 2007) [#2]
Strange, because it should work. Maybe try this:
ExecFile "notepad.exe"
End

(without the ":")?


jfk EO-11110(Posted 2007) [#3]
this works in windowed mode, not in fullscreen. In fullscreen, the calling blitz app will be minimized and paused. The END command will the be executed as soon as somebody clicks the minimized app tab in the taskbar.

One solution is to go into windowed mode frist, before you call the other EXE. If you plan to END, it doesn't matter anyway that you will lose all loaded pics etc. with EndGraphics.


Subirenihil(Posted 2007) [#4]
Programs run using "ExecFile" are indepentant programs - they run along side your blitz program, they are NOT parented to it. It's like you can open paint and notepad and wordpad all at the same time and closing one doesn't affect the others. Your blitz program will continue to run (or end in you case) and the program you started will continue to run. The one won't be affected by the other.


_PJ_(Posted 2007) [#5]
I'm sure I remember seeing something in the CodeArchives so you can see when your app has lost focus.

This might be useful.


Picklesworth(Posted 2007) [#6]
I'm not sure if this is what you want, because your description is rather vague, but this may help:
http://www.blitzbasic.com/toolbox/toolbox.php?tool=151
RunProgram returns a process handle, and you can use that with a lot of Windows API calls. (For example, you can then tell that process to close).


Dirk Krause(Posted 2007) [#7]
The simple thing would be like this:

create a file called a.cmd file with the following content:
notepad
calc


Then run "execfile a.cmd".

Now notepad will start, and calc will follow as soon as you close notepad.