Quick Notes with AppleScript and TextMate

WARNING: NERD POST AHEAD

Merlin showed off his sexy URL scheme and TextMate bundle to create a new datestamped TextMate file in his Elements folder. I use something similar powered by AppleScript and FastScripts to give me a global hotkey. Drop the following script into Script Editor, change _path to a path to a folder you care about, and save it.

Then, whenever you run it, it will ask you for a title. Enter a title and click OK, and you’ll get a file with that name inside the folder you specified, complete with that same name as a Markdown title inside the note.

Msgbox

Note

Here’s the AppleScript:

set _path to "/Users/chad.bailey/Dropbox/Elements/"

set _return to display dialog "Enter a title:" default answer "Title"
if button returned of _return is "OK" then
    set _string to text returned of _return
    do shell script "echo \"# " & _string & "\\n\" >> \"" & _path & _string & ".txt\""
    do shell script "mate -a \"" & _path & _string & ".txt\""
end if

About