Notepad has been around since Windows 3.0. It's a simple, no-frills text editor that does no fancy formatting (though it does enable you to change the display font) and is popular for composing "clean" ASCII (.TXT) files. I use Notepad for jotting down quick notes. You could say Notepad is a text editor, whereas WordPad (see the "WordPad" section later in this chapter) is a word processor. Unlike WordPad, Notepad cannot view or edit Microsoft Word (.DOC) or Rich Text Format (.RTF) files. It's a perfect tool to call up whenever you need to view a simple README.TXT file or fine-tune some program code (programmers like this tool). TIP Here's a quick way to create a Notepad file. Just right-click the desktop or a folder, choose New, Text document. Then type in the name for your document and press Enter. Now press Enter or double-click the icon, and the new Notepad file opens. This is a good technique for taking down a quick memo, making notes about a phone call, or keeping a to-do list on your desktop. Text-only files contain text characters and nothing elseno character formatting such as italics, bold, underlining, or paragraph formatting information such as line spacing, and definitely no graphics. Sometimes such files are called ASCII files, plain ASCII files, or simply text files. As of Notepad version 5 (included in Windows 2000; the Notepad version in Windows XP is version 5.1), the Save As dialog box allows you to save in several text-only file types listed in the Encoding pull-down menu: ANSI, Unicode, UTF-8, and Unicode big endian. These formats provide you with greater flexibility when you're working with documents that use different character sets. The default is ANSI, and unless you are inserting non-U.S. characters, you should use this format when you save files.
Although they're visually boring and lackluster, text files do have some important advantages over formatted text documents. Most importantly, they are the lowest common denominator for exchanging text between different programs and even between different types of computers. Literally any kind of word processor and many other types of programs, from email tools to databases, can share textual information using simple text files, regardless of computer type or operating system. To be sure your recipients using other kinds of computers can read a text email attachment or a text file on a disk, stick with the simple text files such as the ones Notepad creates. Source code used to generate computer programs is often stored as text files, too. Because files are clean, without extraneous codes for formatting, program compilers (software that converts the source code into a working program) are not confused. Good examples of simple ASCII program code or configuration file code are found in the WIN.INI, SYS.INI, PROTOCOL.INI, BOOT.INI, CONFIG.SYS, and AUTOEXEC.BAT files. These files, found in many Windows computers, control various aspects of Windows, all of which can be edited with Notepad. HTML code for Web pages is another example. You can safely edit HTML in Notepad. Windows recognizes any file with a .TXT extension as a text file and opens it in Notepad when you click it. For this reason, README files supplied with programseven some supplied with Windowsare stored as .TXT files. Take a look around on the Windows XP Professional CD, and you'll find some pithy files about setup, networking, and so on. After you open them in Notepad, turn on the Word Wrap feature (by choosing Format, Word Wrap) to view the document correctly.
To learn more about Word Wrap, p. 159. Notepad's LimitationsAs I mentioned previously, Notepad does no formatting. In fact, it doesn't even wrap lines of text to fill the window unless you tell it to. Notepad can't properly render or print formatted documents created with WordPad, Microsoft Word for Windows, WordPerfect, or any other fancy word processor (unless you saved files you create with those programs as ASCII or ANSI text files). You can open these document types, but they look like gibberish. Also, it doesn't have any fancy pagination options, though it does print with headers and footers via the Page Setup dialog box. Although you can change the font in Notepad 5, font information isn't stored in the file. Font choice is a personal preference for viewing and printing, and applies to all files you open in Notepad. TIP Be careful about opening formatted text files with Notepad. Typically, this will take a little doing, because when you use the File, Open command, the box defaults to ".txt" files. But you could enter the entire name of a preexisting file that you wanted to examine, such as a mydocument.doc or mydocument.rtf. A formatted file will probably appear as gibberish in Notepad. Nonetheless, if you accidentally save the file, the formatting is stripped out of it, and the file can become useless. I don't recommend using Notepad to view a file unless you have no other software tool suitable for the purpose, because it's hard to read the file and you can easily damage it. If you want to examine executable files or initialization or control files used by programs, I suggest a file viewer intended for this purpose, such as FVIEW. Many utility programs for this purpose are available on the Web or at software stores. One such program is called QuickView Plus. It's a full version of the quick viewers supplied with Windows 9x. It's available from Avantstar Software (http://www.avantstar.com). QuickView is also useful for viewing the contents of temporary files which may contain a version of a document you were working on when your system locked up. Notepad files used to be limited in size to about 50KB. That's no longer the case. Even very large files can be loaded into Notepad 5.1. Running NotepadTo run Notepad, click Start, More Programs (or just Programs, depending on how you have your taskbar settings), Accessories, Notepad. Notepad then appears on your screen (see Figure 5.1). When it does, you can just type away. Figure 5.1. You can use Notepad to edit simple text. I've entered some text already.Of course, you can choose File, New to start a new file at any time. If you've made changes in the current file and haven't saved them, Notepad asks if you want to save it before creating the new file. You use the standard File, Open and File, Save As commands. You can only have one document open at a time in Notepad. TIP Although you can have only one file open in a particular Notepad window at a time, you can have multiple Notepad windows running. This enables you to cut, copy, and paste text between windows or perform visual file comparisons. You should turn on word wrap when you enter text unless you're entering program code that is line oriented. When you do, by choosing Format, Word Wrap, the text wraps within the constraints of the window. If you resize the window, the text rewraps to fit the available space. Note that the word wrap setting doesn't affect the text file itself. That is, Notepad doesn't insert line feeds or carriage returns at the points where the lines wrap. As with most Windows text programs, the keys shown in Table 5.1 have the effects shown here.
Setting Margins and Adding Headers and FootersDespite the paucity of formatting options for onscreen display, you can format printed output to some degree. Use the File, Page Setup command to establish headers and footers. Enter your desired footing and heading text. Margin changes and header and footer settings aren't visible onscreen but do print. You can also include the special codes shown in Table 5.2 in the header and footer fields. You can enter these codes alone or within a text string.
Here are a couple examples to help you take advantage of these formatting codes. To print the time and filename at the top of each page, add this to the header field in the Page Setup menu as shown in Figure 5.2: Printed at &t Filename is &f Figure 5.2. Adding Header and Footer codes to identify printouts from Notepad.If the time the document was printed was 10:30 a.m. and the filename was README.TXT, the header will appear like this when the document is printed: Printed at 10:30 Filename is Readme.txt By default, &p (page number) is used in the footer field as shown in Figure 5.2, so the page number will print at the bottom of each page unless you add or remove footer codes. When you print a document, Notepad lets you choose the page range, the number of copies, and the printer to which the job is sent. See Chapter 6, "Printing and Faxing," for more details. NOTE You won't be able to select which page(s) to print with Notepad unless the document has had page breaks inserted in it by its creator. For example, the .TXT documents on the Windows XP CD-ROM can only be printed in their entirety. |