Using Notepad

[Previous] [Next]

Notepad's raison d'être is the fact that certain kinds of files must include nothing but text. These include source-code files for programming languages, HTML documents, and .ini files—the files containing configuration information that are used by certain applications (and by some components of the operating system). Notepad is ideal for working with files such as these, because, unlike WordPad or another word processing program, it generates absolutely nothing but a stream of text characters.

The version of Notepad supplied with Windows 2000 offers a few improvements over its predecessors. Most notable is increased capacity. If you've used earlier versions, you might have noticed that the program wasn't capable of editing large text files. If you tried to open a file that was beyond the old Notepad's capacity, a dialog box gave you the choice of opening it in WordPad instead, or of not opening it at all. You'll be glad to know the Windows 2000 version of Notepad has essentially unlimited capacity. Opening a 12 MB text file saved from Registry Editor, for example, is no problem.

You'll also be pleased to see that the new Notepad supports such standard shortcuts as Ctrl+O (Open), Ctrl+S (Save), Ctrl+N (New), Ctrl+P (Print), Ctrl+F (Find), and Ctrl+H (Replace). The inclusion of a Replace command is itself a new feature, as previous versions could search but not replace. The current version's menus also have been rearranged slightly to conform better with Windows standards. The Font command, for example, now resides on a Format menu, as it does in most word processors.

Here's a quick rundown of Notepad's improved, but still modest, feature set.

Using Notepad as a Time Log

Like every version of Notepad from the beginning of Windows, the current version has a hidden feature (that is, one that appears nowhere on the menus) that enables you to use the program as a time log. To use this feature, type .LOG on a line by itself at the top of a new file. (Be sure to include the period at the beginning and type LOG in capital letters.) Save the file and close it.

Each time you reopen this file, Windows appends the current date and time at the end of the file. Thus, to log a work activity:

  1. Open the file.
  2. The current time and date appear at the bottom of the file. You can add some brief text to its right as a notation, such as Start Project.

  3. Save the file and close it, or leave it open or minimized.
  4. After completing the work you want to log, reopen the file. If you left the file open, choose Open from the File menu to reopen it anyway (answer yes when prompted to save) so that new time and date will be appended to the file.
  5. Add a notation to the right of the new date if you want—such as Stop for Lunch—save it, and close it.

Alternatively, you can add the current date and time to a file manually by opening the Edit menu and choosing Time/Date. (F5 is the shortcut key for this command.) The date and time appear at the current cursor location.

Understanding Encoding Options

As Figure 33-1 shows, Notepad's Save As dialog box now includes an Encoding list, offering four options: ANSI, Unicode, Unicode Big Endian, and UTF-8. ANSI is the default and is suitable for English and other languages that use the Latin alphabet. Unicode, a superset of ANSI, allows for a great many additional characters. If you work with Hebrew, Russian, Arabic, Japanese, or another language that doesn't use the Latin alphabet, you will probably need to save your files in Unicode.

click to view at full size.

Figure 33-1. You can save Notepad documents in any of four encoding schemes.

Use Unicode Big Endian if you need to transport your documents to a Macintosh or other computer that doesn't use an Intel microprocessor. (The term big endian refers to the order in which the two bytes of a data word are stored.) UTF-8 (8-bit Universal Character Set Transmission Format) is an 8-bit reduction of Unicode. You might need to use this encoding option if you must transmit Unicode data across a medium that supports only 8 bits of significant data.

Setting Page Setup and Printing Options

Notepad's Page Setup dialog box (shown in Figure 33-2) offers paper selection, print orientation, margin, and header/footer options. Your settings here remain in effect only for the current session. If you switch from portrait orientation to landscape, for example, the Landscape setting will remain in place for all files you work with in the current session. The next time you open Notepad with any file, however, the Orientation setting will revert to the setting you make in the printer's printing preferences dialog box.

click to view at full size.

Figure 33-2. Notepad always reverts to these margin, header, and footer settings at the beginning of a session.

By default, Notepad prints the filename as the page header (the text at the top of each page). It prints the word Page followed by the page number as the page footer (the text at the bottom of each page). Header and footer are both centered by default. You can put any literal text you want in the header or footer (literal text is printed as is on every page). Notepad also recognizes the following codes, which either format the text or act as variables to be replaced with text at print time.

Type This Notepad Prints
&f The current filename (or (Untitled) if you haven't saved the file)
&d The current date
&t The current time
&p The page number
&& A literal ampersand
&l The header or footer left aligned
&c The header or footer centered
&r The header or footer right aligned

Notepad now uses the common Windows Print dialog box—the same one used by WordPad. See Figure 33-14. With this dialog box, you can now choose which printer you want to use and specify the page range that you want to print.

Searching, Replacing, and Navigating

The Edit menu includes the aforementioned Find and Replace commands. Once you've searched for something, you can search for it again by using the Edit menu's Find Next command—or, more simply, by pressing F3.

The Edit menu's new Goto command (the shortcut is Ctrl+G) lets you move directly to a particular line number. You might find this useful if your file consists of information arranged in lines, such as the records of a database file or the numbered lines of a programming language like Basic. It's less useful for files containing text in paragraphs.

TIP
Counting the Number of Lines in a File

Want to know the number of lines in your file? Press Ctrl+G to open the Goto Line dialog box and type a very large number in it. Notepad will beep and tell you there's no such line number. Acknowledge by clicking OK, and the Goto Line dialog box will then replace your large number with the number of the last line in the file. Use that number to estimate the length of the file, the number of records in a database file, the number of lines in a computer program, or perhaps divide the number in half to move to the middle of the file. If you want to count only entire lines (no matter how long each line—or paragraph—might be), make sure the Word Wrap feature on the Format menu is turned off.

To get to the end of a file, press Ctrl+End. To get to the beginning, use Ctrl+Home. To select everything in the file, press Ctrl+A, or choose Select All from the Edit menu.

Choosing Display Options

The Format menu includes two commands that affect the display, but not the content, of your file: Word Wrap and Font.

The Word Wrap command, a toggle that's on by default, causes text to wrap at the right edge of the window, just as it wraps at the right margin in a word processing program. If you're using Notepad as a program source-code editor, you might want to turn this feature off to prevent lines from wrapping.

The Font command summons a common font dialog box. Note that your choice of font affects the entire document. You can't apply it to individual selections, and the font is not recorded in the file, because that would defeat the purpose of producing files that are text-only—that is, files with no formatting codes. However, Notepad will remember the font you select and continue to use it as its default display font until you change it again.



Running Microsoft Windows 2000 Professional
Running Microsoft Windows 2000 Professional
ISBN: 1572318384
EAN: 2147483647
Year: 2000
Pages: 317

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