cdf ()
{
currFolderPath=$( /usr/bin/osascript <<EOT
tell application "Finder"
try
set currFolder to (folder of the front window as alias)
on error
set currFolder to (path to desktop folder as alias)
end try
POSIX path of currFolder
end tell
EOT
);
echo "cd to \"$currFolderPath\"";
cd "$currFolderPath"
}https://github.com/JXA-Cookbook/JXA-Cookbook
I know it’s not quite what you are asking, but I hope it provides some benefit.
1. Before I ported my CV to LaTeX to fully automate assembly, I had an AppleScript that would export a CV generated in InDesign to PDF with certain settings.
2. I have a small AppleScript that toggles Dark Mode on Mohave.