I've pointed Hazel at this directory
The first file of interest is 02-Un-amour-de-Swann.pdf. I use the Highlights PDF app to write notes in this PDF file.
Highlights creates a markdown sidecar file named 02-Un-amour-de-Swann.md each time that I save the PDF file.
I've written a Ruby script that modifies the markdown sidecar file. Each time that the sidecar file changes, I want Hazel to run that script and save the output in another file.
Here is the exact shell command. It works when executed by hand in this directory:
- Code: Select all
$ cat 02-Un-amour-de-Swann.md | /Users/ge/Dropbox/obsidian/home/books/marcel-proust/chronologie/matthews/mk-chronologie-highlights-md-md.rb > 02-Un-amour-de-Swann-2022-08-11.md
Note that I'm sending the sidecar file to the script's STDIN file handle.
I want Hazel to do this each time the sidecar is recreated. But as far as I can tell, the only way Hazel can tell an external script where a file is is to pass it as a command-line argument, visible to a shell script as $1 or to a Ruby script as ARGV[0]. In other words, Hazel doesn't seem able to supply a file to the script's STDIN file handle.
I think I can work around this limitation, but I'd like to know if my understanding of Hazel external scripting is correct.
1. Can Hazel provide a file to a script's STDIN?
2. Can Hazel save STDOUT from an external (or internal) script to a specific file, say with the "Sort into subfolder" command?
3. Can someone suggest a workaround?