Kill external program (Solved)

I am trying to play a random music selection in the background of a presentation in impress. Impress can play music of course, but not (I think) randomise the selection. So I call an external program (VLC) to start the music. This works.

Now I need to stop the music at a certain point in the presentation (end of slide 0). I have set a listener which gains control at the end of slide 0. How do I kill my external program to stop the music?

https://forum.videolan.org/viewtopic.php?t=54212

Thanks, Mike. That’s enabled me to write a small script to kill vlc. The problem has now shifted slightly as edited above.

The edit should have been posted as an answer, not part of the question. It is perfectly fine to accept your own answer. In this case, I posted it for you.

Thanks, Jim

@Pansmanser wrote:

Thanks to Mike Kaganski I can now achieve this under certain circumstances. I ‘shell’ to “killall vlc” to stop the music. It works perfectly when the slide show is running in ‘Window’ (Slide Show Settings - Type - Window; in this form the slide show runs within the Impress process and window already active).

When the show runs in ‘Default’ (which makes it run in a separate process and a detached window), it stops working. This is a different issue and I have opened a different question here Listeners when impress runs in 'default' window type (solved).