How execute a file from blitzmax ?

BlitzMax Forums/BlitzMax Programming/How execute a file from blitzmax ?

Filax(Posted 2005) [#1]
How execute an exe file from blitzmax ? i need this to make
my breakout editor :)

Thanks :)


klepto2(Posted 2005) [#2]
system_("your_editor.exe")

This should do it if you mean to run another App from an BMax app.


Filax(Posted 2005) [#3]
Many thanks !


Perturbatio(Posted 2005) [#4]
it should be noted that your calling app will wait until the app you call with system_ is finished.


semar(Posted 2005) [#5]
@Klepto,
that is indeed handy.

I modified the Kernel32.bmx and added the WinExec API declaration to it, which has turned to be successfull, and when I came here to answer filax, I've noticed your post !

:)

I have a question, where did you find the documentation of the 'system_' command ? Am I right to assume that it is a multiplatform command - that is, it would work also on a linux or a mac OS ?

Anyway, if you want to use WinExec API, then:
1) go to the pub.mod directory and make a copy of the win32.mod directory - just in case !
2) open the win32.mod directory and locate the kernel32.bmx file
3) open the kernel32.bmx file from the IDE, and add this statement to the functions declared in it:
Function WinExec (lpCmdLine:Byte Ptr,nCmdShow)

4) save the kernel32.bmx file
5) now go in the bin directory of your main BMAX installation, and create a file .bat which contains the following statements:
bmk makemods pub.win32
pause

6) run that .bat file
7) now you can use the WinExec function:
WinExec("calc.exe",10)


Note that WinExec does not halt the calling application as the command system_ does.

Hope it helps,
Sergio.


Filax(Posted 2005) [#6]
Excellent ! many thanks


klepto2(Posted 2005) [#7]
Its part of the pub.StdC Module.
As I remember right its an undocumented Module. But you can make the commands visible by using the documenta tool of Fredborg.
Maybe you have to set 'undocumented' to True in the Code to let documenta list them.

But at least i haven't found it. This command was mentioned in a previous Topic before.


Filax(Posted 2005) [#8]
Ok thanks for informations !


morszeck(Posted 2005) [#9]
Under Linux is this very cool!

system_("gedit") ' starts and waits for end the program.

system_("gedit &") ' starts, however your program continues.


:-)


FlameDuck(Posted 2005) [#10]
Under Linux is it very cool!
Now that is cool!


Perturbatio(Posted 2005) [#11]
yup yup, very handy.


Filax(Posted 2005) [#12]
Is there a similar command to wait a program end on PC ?