Tutorial: Create A Readme-File Finder Shortcut

There are a few things I always do when starting a project: make a NotesAndIdeas.txt  and a Readme.md  file. But opening a blank text file and saving it to the right location is a pain. To the rescue: a Finder keyboard shortcut.

1. WRITE A LITTLE SCRIPT

01-web
We’ll use an AppleScript to create the files. This requires two parts: getting the current directory and creating the file using a bash script. In the notes file, I’m adding a header to the top of the file, but you could add any text you want. Newlines must be escaped with two backslash characters: \\n .

I save my scripts to a folder called Hacks to I can tweak them later, if necessary.

2. SAVE AS AN APPLICATION

02-web

Save the AppleScript file, then go to File > Export...  and choose the options above. It will save as a .app package, like any other application.

3. CREATE A SERVICE

03-web

We could run this application directly (using Spotlight, for example) but creating a Service using Automator will let us create a keyboard shortcut for it. Open Automator ( Applications > Automator... ) and select Service.

04-web

At the top, set input as no input and choose Finder.app (since we only want this shortcut to work in the Finder, so it won’t conflict with other applications).

05-web

Add the Launch Application action (you can search for it on the left) and select the name of your script.

06-web

Save it – this is the name that will appear in Finder > Services...  so make it clear. Hit save!

4. CREATE A SHORTCUT

07-web

We could access our new tool from Finder > Services...  but a keyboard shortcut will make this really useful. Go to System Preferences > Keyboard > Shortcuts...  and select App Shortcuts from the menu on the left. Click Finder… and create a new shortcut (the plus button). The Menu Title must be the exact name of your application. Create a new shortcut and hit Add.

5. TEST IT OUT!
Test your shortcut and make sure it works! Hopefully this will save you lots of time. This could be extended for all kinds of projects: websites could get index and stylesheet files. Twitter bots could get a main Python and settings file… you could even run an ImageMagick script to generate a random profile image!

CHANGE YOUR MIND?
Need to modify or delete a Service? They are located at ~/Library/Services .

Did you find this post helpful or interesting? A small donation goes a long way towards helping produce this content. If you can't, please share what you've done with others!
Donate via Flattr

Leave a Reply

Your email address will not be published. Required fields are marked *