AppleScripts

04 Sep 2016

So, I wrote a couple of AppleScripts and connected them to keyboard shortcuts to make my life easier. The first opens a terminal window with the working directory set to the current folder in Finder. The second opens the selected files in MacVim - this is particularly useful for html files.

To set this up, open Automator and choose the Service option.

Then search for Run AppleScript in Actions.
Type in your code and choose the appropriate settings for where the script should run and what inputs it should receive. For the terminal script it should be: Service receives no input in any application. For the Vim script it should be: Service receives files or folders in Finder.
Save your service. Now open System Preferences head to Keyboard then Shortcuts in the segmented control at the top. Choose Services in the left hend list, then scroll to your newly created script.
Check the box and assign it a keyboard shortcut.

The script to open a new Terminal window in the current Finder location is: