Shell.execute with visible console windows

Hi ,

I am new to Xojo. I am trying to launch a VC++ console application with a few parameters with Xojo. All works fine as spected ecept that I want the console window to be visible while the VC++ app is running.

I used to do it in VB6 like this:

Dim comando As String
comando = “E:\m4c\OpencvTest_D810_landscape_rth” + " " + Text4.Text + " " + Text1.Text
Shell comando, vbNormalFocus

How can I do it in Xojo?

Thanks for your help and time!

Manuel

you have to use the "OPEN -n " seqeunce (I think that is right) for macOS
and there is a similar Windows command required, I experimented with them a while back, but decided on another direction for my particular project… there may be a topic or two on this forum disccusing those commands

This may be better served by using f.launch

  • Dave, i can’t find the right command on this forum… where else can I look?

  • Langue, folderItem.launch works as I want BUT I need to find a simple way to make my Xojo app wait until the launched VC++ console app finishes. Is it possible to do it in a simple way? (with Shell. execute in mode 1, I was juts polling sh.isRunning)

  • This is running in a background thread

Thanks!!
Manuel

Dave,

I have found that using “start” instead of your “OPEN” works in Windows. Unluckly when I use it, “shell.IsRunning” seems to stop working and my Xojo app fails to wait until the VC++ app ends.

Any ideas?

Thanks for your help!!
Manuel

Shell.mode = 1 Shell.timeout = -1 Shell.Execute("start /wait ftp")

As long as you run an external program and not an internal command (type help in a cmd window to see these) or batch file then the cmd window will close when the program is closed (ftp in the above example).

Let me know if you cant get it working and I’ll post up a demo.

Julian,

I got it working like this:


dim sh as new shell
sh.mode = 1

sh.execute = ( "start /wait " + “my_console_app.exe”, my_parameters)

while sh.isRunning
wend

I stil need the “while wend” to make the code wait and, in my case, “sh.timeOut = -1” don’t seem to be doing anything.

All sorted out. Thanks so much for your Help!!!

Best,
Manuel