Shell to start app then quit with the app running

I need to start VLC and have it show the video from my network camera, then it should do just nothing.

In Mode 0, it won’t quit until VLC is quit (spinning wheel).

In Mode 1 it needs to open a msgbox and closes as soon as ok is pressed. I don’t understand why, the LR does not help, I am just doing because it was suggested somewhere. If I do not add the msgbox to the code, then VLC will not start. Why?

[code] dim sh as new shell
sh.Mode =1
sh.Execute str("/Egna_Program/VideoDVD/VLC\ 1.1.12.app/Contents/MacOS/VLC http://admin:password@192.168.1.11/video.cgi")

msgbox str(sh.Result)[/code]

-Basically I would only need it to start VLC, log in and then quit it self, with VLC still running. Can I do that?
If I pass the string in the terminal and quit the terminal VLC keeps running, but if I close the app running the shell VLC is killed too.

[quote=177531:@Roger Jönsson]I need to start VLC and have it show the video from my network camera, then it should do just nothing.
In Mode 0, it won’t quit until VLC is quit (spinning wheel).

In Mode 1 it needs to open a msgbox and closes as soon as ok is pressed. I don’t understand why, the LR does not help, I am just doing because it was suggested somewhere. If I do not open the msgbox, then VLC will not start:

[code] dim sh as new shell
sh.Mode =1
sh.Execute str("/Egna_Program/VideoDVD/VLC\ 1.1.12.app/Contents/MacOS/VLC http://admin:password@192.168.1.11/video.cgi")

msgbox str(sh.Result)[/code]

-Basically I would only need it to start VLC, log in and then quit it self, with VLC still running. Can I do that?
If I pass the string in the terminal and quit the terminal VLC keeps running, but if I close the app running the shell VLC is killed too.[/quote]

You are launching the Unix executable inside VLC, that is the reason why it becomes a child process.

I see you seem to need that to pass the URL to VLC. There is no way to quit after you launch a child process, otherwise it will kill it. The best you can do is to monitor Shell.IsRunning, and quit when VLC is terminated.

Maybe it would work if instead you point a folderitem to VLC 1.1.12.app (NOT the UNix exec inside), and launch it with the URL as argument. Something like :

dim f as folderitem = Getfolderitem("/Egna_Program/VideoDVD/VLC\\ 1.1.12.app", FolderItem.PathTypeShell) f.launch("http://admin:password@192.168.1.11/video.cgi")

Doing so will not tie both apps, so you will be able to quit your app after launching VC.

OK. This works perfectly. You launch and then can quit your application :

dim f as folderitem = SpecialFolder.Applications.child("VLC.app") f.launch("http://www.podtrac.com/pts/redirect.mp4/twit.cachefly.net/video/code/code0061/code0061_h264b_640x368_256.mp4")

I pointed to the Coding 101 video show since your URL requires a password. I also used the specialfolder.Applications since my copy of VLC is in there.

I figured something like that was going on…
Just to understand this better: In mode 1 the examples use the msgbox showing shell.result. When clicking ok, VLC is killed. The shell.result seems be the trigger that starts the process (which runs as long as the msgbox is open). Hm. How does that work? Can I do that in another way than using the msgbox?

[quote=177534:@Michel Bujardet]Maybe it would work if instead you point a folderitem to VLC 1.1.12.app (NOT the UNix exec inside), and launch it with the URL as argument. Something like :

dim f as folderitem = Getfolderitem("/Egna_Program/VideoDVD/VLC\\ 1.1.12.app", FolderItem.PathTypeShell) f.launch("http://admin:password@192.168.1.11/video.cgi")[/quote]
That approach works beautifully. Perfect. I learned something new (how to pass the parameters). Thank you!

In mode 1 you should not expect result the same way as in mode zero, since it is asynchronous, but use the DataAvailable event to know when you can read Result.

In Mode 1, your shell goes out of scope, which kills the child process. You would need to use a window or module shell property instead, or a class, to insure it survives the button action event. The Msgbox does nothing more tha to halt execution, holding the ax until you click OK. When you do so, the event terminates, the shell goes into oblivion and your child process terminates.

At any rate, simply use launch() and you will be fine.