I hope everyone is enjoying summer! Although it might be winder for Mariano,
I have been trying various ways to play sounds (wav files, etc...) on Linux and Windows. Originally I was running a program like aplay and VLC on Linux and VLC and WMP on Windows. I tried using platform functions. I can do that on Windows but couldn't on Linux (I'll rant about that in a minute). So, I'm back to using #OsProcessStarter to call a program to play the sound.
#OsProcessStarter works great but it wants the command and the args in an ordered collection. That generally isn't a big deal but I want the user to be able to choose the program to be used to play the sound file (see the rant). That would require my settings code to have the user enter the entries of the collection that #OsProcessStarter needs. That is doable but a mess. I much prefer the user enter a string for the sound playing program with %1 as a place holder for the path to the file (different sounds can be played at different times). This is easy enough to do but then I have to break that string apart to feed #OsProcessStarter the collection it wants.
I wrote an extension to #EsString to parse the string and answer an #OrderedCollection that #OsProcessStarter is happy with (see attached). Feel free to use it. Instantiations can add it to the product if they like. They may also think about adding a method to #OsProcessStarter that accepts the command as a string, and then parses it into the command collection it needs.
Now for the rant. In this case Widows is innocent, it has both commands and platform functions that can be called to play sound files. Linux also has commands and platform functions but they no-longer if called by a super user (sudo). I have a patched/hacked VLC that works but I'm not crazy about using patched code that can get unpatched with any update. The authors of the sound/audio systems have their reasons for not allowing super users to call the sound system code and they are probably good reasons. BUT, if one has super user powers, one can mess things up without involving the sound system. Sure, if you want to warn people off, warn them off but give us a way to take the risk and do what we want. Yea, I know I could get and modify the source and compile it, bla bla bla. No thanks.
Lou