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
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 .
tell application "Finder"
select the front Finder window
set targetFolder to insertion location as alias
set folderPath to POSIX path of targetFolder
set makeNoteFile to "echo '\\nNOTES && IDEAS:\\n' >> " & quoted form of folderPath & "/NotesAndIdeas.txt"
do shell script makeNoteFile
I save my scripts to a folder called Hacks to I can tweak them later, if necessary.
2. SAVE AS AN APPLICATION
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
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.
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).
Add the Launch Application action (you can search for it on the left) and select the name of your script.
Save it – this is the name that will appear in Finder > Services... so make it clear. Hit save!
4. CREATE A SHORTCUT
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 .