Execute an external command?

BlitzMax Forums/BlitzMax Programming/Execute an external command?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

(Recently posted on another thread)



This should work on all three systems. Not certain though.
It uses Skids excellent FreeProcess library.

I have pulled various bits out of my FrameWork Assistant to show you how I launch an external program:

First, import skidracers module:
Import PUB.FreeProcess

Now create a global TProcess variable:
Global proc:TProcess

When you are ready to launch an external program:
Function RunApp(myapp$)
    ' check if application is still running
    If proc<>Null
        If proc.Status()
            Notify "program still running!"
            Return
        EndIf
    EndIf
    ' run program
    proc=TProcess.Create(myapp$,0)
    If Not Proc
        Notify "Failed to launch "+myapp$
    EndIf
End Function


What's nice about this method is, you can prevent multiple launches of an application (as I do above) and when you close your own program Max shuts down the running app too.