Thank you for the update. The whole point of runCommand() is you don’t need the AppleScript and Terminal. runCommand() ‘speaks’ directly to the Mac’s Unix shell. As you’d need to use runCommand to call your AppleScript, it is extra work for no reward.
I assume, because you didn’t report it as working, that the runCommand() example I gave you didn’t work. Looking at your AppleScript script example there is a path element (that wasn’t mentioned in your original example). So have you tried a command like:
var:string vCmd = "xargs quarto";
var:string vArgs= "preview ja.qmd";
var:string vPath = "~/Documents/Tinderbox9/2023quarto";
runCommand(vCmd, vArgs, vPath);
Depending on how big complex your Quarto file is, you can actually skip exporting that and just pass the exported data (currently saved to ja.md) directly into runCommand().
So a pseudo example (as I don’t have all the data & apps to try it):
var:string vCmd = "xargs quarto";
var:string vArgs= 'preview "'+exportedString("ja")+'"';
var:string vPath = "~/Documents/Tinderbox9/2023quarto";
runCommand(vCmd, vArgs, vPath);
I’d recommend getting the first example method (of the two in the this post) to work before trying the second. The whole point of the approach is to change only a little part of the process at a time.
It is difficult to be precise on what works as whilst we are all using Tinderbox, not all Mac unix shells are configured the same way. This is why starting with a Terminal command that works is a got starting play when trying to figure out a runCommand() value to use. The possible parts are:
- the shell command (e.g. like
quarto
) - does it run from anywhere - the command’s flags (e.g.
preview
) that trigger different behaviours in the command - other input such as data file(s) which might, in Terminal, be supplied via stdIn or as an argument (alongside the flag(s).
- the relative location of data file(s) to where runCommand() executes in the shell. By default this is you home folder (
~
), so if calling a data file (above) which isn’t at~
you need to supply the path to it (either full path or path relative to~
.
Anyway, whilst I’m glad your AppleScript test worked, it is not part of the solution here. Think of runCommand() as similar to being able to type into Terminal directly from inside Tinderbox.