AppleScript by Example: Episode 1

If you’re new to AppleScript like me, you might find it challenging to grasp at first. The mental model behind AppleScript is quite different from what most developers are used to. Nevertheless, there are times when you’ll need to write AppleScript code to automate tasks on your Mac. Today, I had to write an AppleScript, and after some googling, stackoverflowing, and chatgpting, I came up with the following solution: tell application "Finder" set currentFinderWindowPath to (POSIX path of (target of front window as alias)) end tell tell application "Terminal" do script "cd " & currentFinderWindowPath activate end tell Let’s break down what this script does so that I can refer back to it in the future....