News for hackers. Stuff that matters.
Re:Ask HN: Have you written or came across any useful AppleS... by yesenadam on Tuesday November 06, 2018 @07:48PM (#18396271)
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"
  }
Re:Ask HN: Have you written or came across any useful AppleS... by sethammons on Sunday November 04, 2018 @06:48AM (#18375407)
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.
Re:Ask HN: Have you written or came across any useful AppleS... by through on Saturday November 03, 2018 @08:08AM (#18369824)
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

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

Re:Ask HN: Have you written or came across any useful AppleS... by Odenwaelder on Saturday November 03, 2018 @09:08AM (#18370006)
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.

Re:Ask HN: Have you written or came across any useful AppleS... by atmosx on Saturday November 03, 2018 @08:15AM (#18369849)
I wrote one to connect and disconnect to all the corporate VPNs with Viscosity.