I have quite a few rules with embedded scripts which read a file and pass back a new file name based on content analysis. I do this analysis with a xonsh (https://xon.sh/) script.
The embedded Applescript looks like this:
- Code: Select all
set filePath to POSIX path of theFile
set shellCmd to "/opt/homebrew/bin/xonsh --no-rc $HOME/opt/link/bin/name-for-CSC-statement.xsh" & " " & quoted form of filePath
set shellOut to do shell script shellCmd if shellOut is not equal to "" then
set theRes to {hazelPassesScript:true, hazelOutputAttributes:{shellOut}} else
set theRes to {hazelPassesScript:false} end if
This feels to me pretty convoluted and error prone because Hazel does not use my $PATH variable. (Both /opt/homebrew/bin/ and $HOME/opt/link/bin are in my $PATH.)
Is there a way to let Hazel search for executables in my $PATH variable?
Many thanks,
Leo