Ever since Apple first unveiled the Macintosh, there has been a weird gap in how the desktop metaphor works. All modern operating systems basically divide file operations into two discrete areas: organizing files and editing files.
Files are organized using a file browser. On Macs, that would be the Finder.
To actually edit files, however, you use an application.
The most basic way of switching between the two modes is by opening and closing files. Open a File in the Finder, and you switch to an application and can edit the file’s contents. Close the file to go back to file management.
There is a very basic problem with this arrangement: How do you create new files? On the one hand, since you use the Finder to manage your files, it would make sense to create new files in the Finder - right where you actually want them. On the other hand, since each individual application typically has at least one unique type of file, the Finder can’t create new files - only individual applications can.
Apple’s answer to this is to recreate the Finder within each application. When creating a new file inside an application, that file typically starts out in a kind of limbo; it doesn’t actually exist anywhere until you save it. Once you do, a mini-Finder opens inside the application and asks you to pick where the file should be stored.
Duplicating the Finder’s functionality inside applications just so users can create new files is probably not the best possible solution to this problem. Let’s look at how other systems take care of this issue.
As Keith Lang points out, some Xerox systems solve this problem by having «form-pads» - documents which essentially act as templates for different file types.
Whatever the form or document, you can put it on your Desktop and make new instances of it by selecting it and invoking COPY. Thus, each form can act like a «pad of paper» from which new sheets can be «torn off.»
The user would select certain documents and use them as templates for new documents. This is pretty clever. In fact, it’s so clever that Apple uses it as well, even though Apple’s implementation is so poor that most Mac users probably don’t even know it exists.
Apple renamed Xerox’s form-pad to «stationery pad». You can turn any file into a stationery pad by selecting it in the Finder, getting info, and clicking on «Stationery Pad»:
In earlier versions of Mac OS, this would change the file’s icon, but in Mac OS X it seems to remain unchanged. Simply double-clicking the stationery pad will cause the Finder to create a copy in the same folder and open that copy with the correct application.
There’s an obvious problem with stationery pads: You probably don’t want the new document to appear in the same folder as the stationery pad, unless you create stationery pads for all possible file types in all potentially useful folders. Besides, this option doesn’t work at all with application that save their documents as bundles instead of individual files.
So that’s not really a generally useful solution.
James Mahoney points out that Apple’s solution for its Lisa system was also similar to Xerox’s original solution, but different from the Mac’s solution. GUIdeboo and mprove.de have articles on this. J. Shell explains:
In the Lisa Office System you would select a stationery and use the menu item «Tear Off Stationery» to create a new file/object of that type. What does this mean? It means that there is no need for «Open» or «Save As» dialog boxes.
In unix-like systems, files are typically plain text. This means that most applications don’t have to create their own files; they can work with whatever is thrown at them. Thus, unix-like systems have the handy «touch» command which creates a new, empty file.
In those systems, the problem obviously doesn’t exist; managing files and creating new files can be done using the file browser, independent of applications.
Windows has a context menu which allows users to create new files of some predefined types:1
Apart from being non-obvious and often not offering the particular file types users actually want,2 this is a pretty clean solution.
Creatively named Twitter user haekelschwein points out that RISC OS has an interesting solution to this problem, too. The «Save As» dialog box actually creates a proxy icon which can be dragged to the file browser.
During the 90s, it occurred to Apple that their application-centric approach is really kind of strange, since it forces users to think in terms of applications rather than in terms of documents. Users don’t want to create a Word file, they want to write a letter. So Apple decided that instead of going through applications to create files, users would work with files first and add «parts» to these documents. These parts would be edited using application components which would implement specific tasks.
As in unix-like systems, OpenDoc would essentially require only one single type of file, thus solving the issue of creating new files. Unfortunately, Apple killed OpenDoc before it went anywhere.
The Newton did away with the concept of files altogether. Instead of a file system, it had a database called the «Soup». Since there are no files, there’s no file management. Creating new soup entries was left up to the individual application. Using the Newton’s Notepad, for example, a simple horizontal strike would turn into a note delimiter and thus create a new note.3
With the iPhone, Apple went back to a traditional file system, but retained the idea of leaving file management up to individual applications. Again, there is no file management since there is no access to the file system.
A Better Solution
(Before you do this, make sure to scroll down and read «An Even Better Solution»)
Obviously, we can’t just do away with the file system in our desktop computers, and neither Stationery Pads nor the Context Menu are perfect solutions. However, a commenter on Keith Lang’s post on the Xerox Alto had a great idea: What if you could have a folder in your Dock containing all the templates you need, and simply drag new files from that folder to wherever you want them to be? His idea was to «replenish» that folder using AppleScript. You can read his original solution on Keith’s blog. Here’s my version.
The premise of my solution is that you have a folder containing all of your templates (I’ve named this «All Templates»), and a second folder that will be replenished from the first folder (I’ve named this «New File» for reasons that will shortly become apparent):
Start out by creating these two folders and putting the same templates into each folder. Then, drag the second folder to your Dock. This should explain why I’ve named the folder «New File»:
Of course, that was the easy part. Now we need to set up a Folder Action AppleScript which will replenish the «New File» folder from the «All Templates» folder. I should preface this by pointing out that I’m probably the world’s worst AppleScript programmer, so if you see room for improvements, feel free to drop me a line.
Here’s the Script. You should replace the two paths stored in source_folder and target_folder to the paths to your own two folders. To test the script, you can uncomment the commented line, comment the one before it and the first and the last line, and hit «Run» in the Script Editor. Doing so should replenish the «New File» folder.
on removing folder items from this_folder
set the source_folder to «YourHD:Users:Username:New Files:All Templates:» as alias
set the target_folder to this_folder
#set the target_folder to «YourHD:Users:Username:New Files:New File:» as alias
tell application «Finder»
set the source_files to every file of the source_folder as alias list
repeat with i from 1 to the count of the source_files
set file_name to name of (item i of source_files)
if not (exists file file_name of target_folder) then
copy file (item i of source_files) to folder target_folder
end removing folder items from
Save this Script as a «Script». I’ve saved it to ~/Library/Scripts/Folder Action Scripts.
Finally, we need to attach this Script as a Folder Action Script to our «New File» folder. Right-click the «New File» folder and select «Enable Folder Actions», then right-click again and select «Attach Folder Action…»
Select the Script stored in ~/Library/Scripts/Folder Action Scripts.
And that’s it. To create a new file, simply click on the «New File» folder in the Dock and drag the new file to wherever you want it to be.
After a few seconds, the Folder Action Script should kick in and put a fresh copy of the file back into the «New File» folder. Pretty close to how the Xerox systems worked.
You could also just hold down the Option key to make copies of those files, but really, where’s the fun in that? :-)
An Even Better Solution
Actually, as Alun Bestor points out, this whole AppleScript rigmarole is completely unnecessary. Instead, simply Get Info on the «New File» folder and click «Locked». That way, whenever you drag a file out of the folder, the file is copied. To add new files to the folder, temporarily unlock it. I feel like smacking myself for not coming up with this obvious and elegant solution :-)
Personally, I prefer this method to going to an application, creating a new file, hitting Cmd-S, navigating to the correct folder inside the application’s «Mini Finder», and finally saving the file.
As a lot of readers have pointed out, this context menu can be replicated on the Mac using NuFile or New! Another option is this script which adds a «New File Here» entry to the Scripts menu, and this similar app (here’s the Read Me).
A reader points out that on Windows, applications can add their own entries into the «new file» context menu. The fact that not all necessary files are available in the context menu is thus a problem with individual applications, rather than with the feature itself.
If you’re interested in the Newton, this YouTube video provides a great introduction to some of its UI concepts.
There was a bug in an earlier version of the Script. Thanks to Chris Clark for pointing it out.
If you require a short url to link to this article, please use http://ignco.de/103