in reply to Re: Launch External App in Tk And Return
in thread Launch External App in Tk And Return

I tried using fork, but I don't really understand this. I am on Win, and I was under the impression the Tk was not threadsafe... I can try, though...

Thanks, David

  • Comment on Re^2: Launch External App in Tk And Return

Replies are listed 'Best First'.
Re^3: Launch External App in Tk And Return
by dasgar (Priest) on Sep 29, 2010 at 23:49 UTC

    Since you're using 'system', I presume that the external app in question can be launched via command prompt. In that case, you've got an easy solution. Just add "start " to the front of what you're sending into 'system'. This will tell Windows to run the rest of the command in a new "space" and will immediately return control back to your script.

    For example, if you were launching notepad, you could do it with the following line of code:

    system("notepad");

    That would cause the script to wait until notepad was closed. Instead, modify it to be like this:

    system("start notepad");

    You'll see a command prompt appear, notepad gets opened, the command prompt disappears, and your script continues on. Just apply this to your script/app code in launching the external app and you should be good to go.

    If you want to know more about the various options for the 'start' command, just open a command prompt and type start /? to see the help information.

      Thank you so much. This was easy and exactly what I was looking for. I am launching a Windows only app, so I don't need to worry about portability.
        I am launching a Windows only app, so I don't need to worry about portability.

        There are a lot of nuances to different Windows versions and enviroments .... abstraction frees you from having to learn them all (for ex start is rather basic )