Creating an empty txt file on Mac OS without opening an application first

macos, shortcut, textmate

Solution

alt text http://img64.imageshack.us/img64/2280/screenshot20100106at125.png

This uses TextMate's `mate` command line helper application.

If it's not installed, go to TextMate > Help > Terminal Usage.

#!/bin/bash
cd "$(dirname "$0")"
ntf="Untitled $(date +%s).txt"
touch "$ntf"
mate "$ntf"

- Save this on your Desktop as "New Text File.command"

- Make it executable (in Terminal: chmod +x "New Text File.command")

- Optional: Copy and paste the TextMate icon from TextMate.app's "Get Info" dialog in to your new file's "Get Info" dialog.

Problem

Is there a way to simply create a new document e.g. on the Desktop and open it with e.g. textmate with a simple shortcut or script. I know that the MS Windows approach where you can just create a new empty txt file directly is not working for Mac. I am looking for a method achieving something similar. Any ideas?

Original source