Notepad


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.

ASCII, ANSI, and UnicodeAlphabet Soup Anyone?

ASCII stands for American Standard Code for Information Interchange. Standard ASCII is a 7-bit character-encoding scheme used to represent 128 characters (upper- and lowercase letters, the numbers 0 through 9, punctuation marks, and special control characters) used in U.S. English. Most current Intel-based systems support the use of extended (or "high") ASCII, which is an 8-bit system. The 8th bit allows an additional 128 special symbol characters, foreign-language letters, and graphic symbols to be represented. Even with 8 bits, ASCII is not capable of representing all the combinations of letters and diacritical marks that are used in the Roman alphabet. DOS uses a superset of ASCII called extended ASCII or high ASCII. A more universal standard is the ISO Latin-1 set of characters, which is used by many operating systems, as well as Web browsers.

ANSI stands for the American National Standards Institute. Windows uses the ANSI character set, which is very similar to ASCII. Windows 3.x and Windows 95 support the ANSI character set, which includes 256 characters, numbered 0 to 255. Values 0 to 127 are the same as in the ASCII character set. Values 128 to 255 are similar to the ISO Latin-1 character set but naturally have extensions and incompatibilities.

Unicode, which uses 16 bits, goes beyond ASCII and ANSI. Developed by the Unicode Consortium between 1988 and 1991, Unicode enables almost all the written languages of the world to be represented using a single character set. Using Unicode, 65,536 possible characters can be represented, approximately 39,000 of which have now been assigned, 21,000 of them being used for Chinese ideographs.


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 Limitations

As 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 Notepad

To 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.

Table 5.1. Keys in Notepad

Key

Moves Insertion Point To

Home

Start of the line

End

End of the line

PgUp

Up one window

PgDn

Down one window

Ctrl+Left Arrow

Start of previous word

Ctrl+Right Arrow

Start of next word

Ctrl+Home

Start of the file

Ctrl+End

End of the file

F5 (particular to Notepad)

Inserts the time and date

Ctrl+Backspace

Deletes a word to the left

Del

Deletes letter right

Backspace

Deletes letter left


If you can't see all the text in a Notepad window, see "My Text Is Chopped Off" in the "Troubleshooting" section at the end of this chapter.



Setting Margins and Adding Headers and Footers

Despite 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.

Table 5.2. Formatting Codes for Notepad

Code

Effect

&d

Includes the current date

&p

Includes the page number

&f

Includes the filename

&l

Forces subsequent text to left-align at the margin

&r

Forces subsequent text to right-align at the margin

&c

Centers the subsequent text

&t

Includes the time of the printing


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.




Special Edition Using Microsoft Windows XP Professional
Special Edition Using Microsoft Windows XP Professional (3rd Edition)
ISBN: 0789732807
EAN: 2147483647
Year: 2003
Pages: 450

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