Creating the Scrivener Compile script…
In a separate thread, I asked for help figuring out how to pass both scriv_file
and compiled_md_file
as parameters to Squarto within the Compile bash script. It turns out that Scrivener only has a placeholder for the compiled .md file (<$outputfile>
), but sadly lacks an equivalent placeholder for the source file, which I figured would be named something like <$projectfile>
. Thanks to @nontroppo, who mentioned trying other kinds of scripting, I used Keyboard Maestro (KM) to run a menu command in Scrivener that reveals the .scriv file in a Finder window, then copies that file’s path to the clipboard, and launches the standard Compile modal window. Scrivener then processes the compilation and runs the post-processing bash script, which grabs the KM-derived path to the .scriv file (from the clipboard) and a few other arguments specified in the Scrivener compile-format text field, and it runs Squarto with all these parameters. The process works pretty well, but I’m a bit bummed that I had to rely on KM to get the job done. Oh well… I’m very thankful that KM exists to save the day!
If you’re interested in this type of thing, check out the more complete explanation in the original thread.