Adding File Templates

I'm sure you know about the New menu. Right-click within any folder, click New, and choose one of the templates available to create a new, empty file; then double-click the new file to edit it. By default, Windows XP provides the following templates: Briefcase, Bitmap Image, Wordpad Document, Rich Text Document, Text Document, Wave Sound, and Compressed (Zipped Folder). You can add templates, though, making the chore of starting new files quicker and easier.

Adding new templates is a two-step process:

  1. In the file extension key HKCR\.ext, create the ShellNew subkey.

  2. Add one of the following four values to the ShellNew subkey to define how Windows XP creates new files of this type:

    • NullFile. This is an empty REG_SZ value. Windows XP creates a zero-length file. Make sure that the associated program can handle empty files.

    • FileName. This is a REG_SZ value that contains the name of a template file. By default, Windows XP looks in %USERPROFILE%\Templates for this file, but you can include an explicit path.

    • Data. This is a REG_BINARY value containing a binary stream of data that Windows XP uses to create the new file.

    • Command. This is a REG_SZ value. Windows XP executes the command in this value, passing it the path and name of the file it's to create.

For example, the template for the .txt file extension creates a null file. Then doubleclick the file to edit it in Notepad. If you'd rather create the file and open it in Notepad automatically, remove the value NullFile from the key HKCR\.txt\ShellNew. Then add the value Command, and set it to Notepad.exe "%1". When you create a new text file using the New menu, Notepad starts and asks you if you want it create the new file. Ideally, any application you launch using the Command value would have a command-line option to suppress the prompt, though. Most don't, and you have no choice but to answer it.



Microsoft Windows XP Registry Guide
Microsoft Windows XP Registry Guide (Bpg-Other)
ISBN: 0735617880
EAN: 2147483647
Year: 2005
Pages: 185

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net