Wednesday, June 3, 2009

File templating on the Mac

Have you ever been looking at a folder in the Finder and thought, "Now, what I want to do is make a new Word document here..."

It's not easy. Without this, that is: New File Here (AppleScript)


Download this file, double-click it to decompress it, then drag it into your home directory -> Library -> Scripts. (Create the Scripts folder if it doesn't exist.)

Then you should be able to select "New File Here" from the scripts menu when you're in the Finder:


If you don't see that icon, go to Applications -> AppleScript and run the AppleScript Utility, and select "Show script menu in menu bar".

I use Keyboard Maestro to link that script to ctrl-n.

Now what do I do?

Step 1: Go ahead and run the script. It'll offer to create a templates folder in your library directory, and then it'll open it for you.

Step 2: Copy whatever templates you'd like to use into that folder. I went into Word, Excel, etc., and created blank files that looked exactly like I want new/empty files to look when I start one, and dragged those into that folder. Or you can use templates like envelopes, letterheads, etc.

Make sure you use the right extensions on the filenames. That's how the script knows what type of file you're wanting to create. (If you don't specify an extension when it asks for the new filename, it makes BBEdit text files.)


Update: Now the file's actually readable! - BH, 4 June 2009


Sebastian said...

It seems that the zip file you provided cannot be decompressed. It ends in a .cpgz file which in turn decompresses to a .zip file. And then we start from the beginning. Could you provide the script itself? Thanks a lot.

bryan said...

The original file had the world-readable permission turned off -- sorry about that, try it again. - BH

Hariharan said...

Just change this line after activate to create new file in desktop. I got an error message "Cant convert desktop to type folder". After removing folder, i am able to create new file in desktop :-)

set frontWinPath to desktop -- get path to desktop folder

Does anyone read this thing?

views since Feb. 9, 2008