In the scripting section of the Ardour manual (The Ardour Manual - Lua Scripting), it says you can “launch an external application when a track is soloed” What is the best way to launch an external application?
For example I am trying to launch musescore to automatically open an exported midi file, if I do os.execute(mscore) it just crashes Ardour. I did find I was able to run “ls -l” and view the output.
What is the best way to launch a GUI app with LUA or is that not really possible?
perhaps you’re missing quotes? or have you set mscore variable to the absolute path?
Also I assume you don’t want Ardour’s UI thread to stall until you close the child app, but want to fork a process. Assuming you’re on Linux or macOS try:
Thank you for your help on this Robin. To clarify I forgot to put the quotes in when I made the post. (Was on my lunch break when I posted).
I tried out the script from the github page and I got xterm to launch, however when I tried to launch musescore, I see that it spawns the process but GUI never launches.
I have tried both with the same result
os.forkexec ("/usr/bin/mscore")
-- and
os.forkexec ("/bin/sh", "-c", "mscore")
Maybe the issue is that Ardour uses the soundcard… or perhaps some issue with environment (Lua’s forkexec inherits Ardour’s environment, except the LD_LIBRARY_PATH variable).
First create a shell script that starts a cron job that will start musescore with the midi file every minute then have the script pause for 90 seconds then have the script do crontab -r to clear the cronjob so musescore doesn’t keep executing every minute