Ask HN: Have you written or came across any useful AppleScript on MacOS - truth_seeker
======
yesenadam
Came across this somewhere: "cdf" changes the current bash directory to the
one open in Finder.

    
    
      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"
      }

------
sethammons
It was a while back, but I think it was in applescript. I had set it up so if
I pressed some modifier key twice it would toggle the F* keys allowing me to
not have to press the Fn key. It was for acccessing game hotkeys (maybe
StarCraft II). It worked for a while and after some system upgrade, it stopped
working. I was never motivated enough to find out why.

------
through
Indirectly, yes, though I found myself disliking the AppleScript language, so
turned to JXA which provides the same functionality in ECMAScript. I found
this repo to be helpful for both languages:

[https://github.com/JXA-Cookbook/JXA-Cookbook](https://github.com/JXA-
Cookbook/JXA-Cookbook)

I know it’s not quite what you are asking, but I hope it provides some
benefit.

------
Odenwaelder
Yes:

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.

------
atmosx
I wrote one to connect and disconnect to all the corporate VPNs with
Viscosity.

