Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Notepad Font Default Settings - Changing

Status
Not open for further replies.

pickymiss

Technical User
Feb 19, 2003
12
US
I have a program that runs reports to the screen in Notepad and the font and its size have an effect on the readability of the file I see - the font has to be an equally-spaced letter font.

Ocassionally in a Notepad document, I will change the Notepad font and its size for something and I am looking for the answer to the following question:

What do I need to do to set this so that every file will not open in the new font (see example for description)? I have checked the registry and find no folder for "Notepad" default settings, nor do I find anything in the program itself saying how to make all documents appear in a certain way.

Example, I set something to temporarily be in Tahoma, Size 14. Every subsequent document will also be in Tahoma, Size 14 until "something" changes.

It is the "something" that I am unable to find. Changing the font and font size on a subsequent document, saving it, closing it, or any combination of those actions does not always change it back to "Lucida Console, Size 6" for example, this has to be done in a certain way and I have been unable to establish a pattern, or to find a way to do change it 100% of the time. Eventually, I do get it put back to something readable, but it is very annoying to change each document in the meantime.

The last time I had an issue that stumped my co-workers, Tek-Tips answered it in an hour... so I am hoping to have equally good luck this time.
 
You need to force a registry structure, and then you can easily use a batch file, even in your logon script, to change the settings.

The following batch file by newsgroup respondent Ruul Morawetz is a little bit fancy, but will force a standard set of defaults for notepad:

:: BEGIN NOTEPR.BAT 03/02/14 by ruul morawetz
@echo off
if [%1]==[] goto _USAGE
if exist %1 goto _FOUND
goto _NOTFOUND

:_FOUND
set _npf1=%TEMP%.\_np1.reg
set _npf2=%TEMP%.\_np2.reg

start /W regedit /E %_npf1% "HKEY_CURRENT_USER\Software\Microsoft\Notepad"

> %_npf2% echo REGEDIT4
>> %_npf2% echo.
>> %_npf2% echo [HKEY_CURRENT_USER\Software\Microsoft\Notepad]
>> %_npf2% echo "lfEscapement"=dword:00000000
>> %_npf2% echo "lfOrientation"=dword:00000000
>> %_npf2% echo "lfWeight"=dword:00000190
>> %_npf2% echo "lfItalic"=dword:00000000
>> %_npf2% echo "lfUnderline"=dword:00000000
>> %_npf2% echo "lfStrikeOut"=dword:00000000
>> %_npf2% echo "lfCharSet"=dword:00000000
>> %_npf2% echo "lfOutPrecision"=dword:00000003
>> %_npf2% echo "lfClipPrecision"=dword:00000002
>> %_npf2% echo "lfQuality"=dword:00000001
>> %_npf2% echo "lfPitchAndFamily"=dword:00000031
:: Font size
>> %_npf2% echo "iPointSize"=dword:0000005a
>> %_npf2% echo "fWrap"=dword:00000001
>> %_npf2% echo "StatusBar"=dword:00000000
>> %_npf2% echo "fSaveWindowPositions"=dword:00000000
:: Font face
>> %_npf2% echo "lfFaceName"="Courier New"
>> %_npf2% echo "szHeader"="&c &n"
>> %_npf2% echo "szTrailer"="&l &d &u &r S.&s"
>> %_npf2% echo "iMarginTop"=dword:000005dc
>> %_npf2% echo "iMarginBottom"=dword:000005dc
>> %_npf2% echo "iMarginLeft"=dword:000005dc
>> %_npf2% echo "iMarginRight"=dword:000003e8
>> %_npf2% echo "fMLE_is_broken"=dword:00000000
>> %_npf2% echo "iWindowPosX"=dword:0000005c
>> %_npf2% echo "iWindowPosY"=dword:0000000f
>> %_npf2% echo "iWindowPosDX"=dword:00000385
>> %_npf2% echo "iWindowPosDY"=dword:00000260
>> %_npf2% echo.

start /W regedit /S %_npf2%

:: printing:
:: start /W notepad /P %1
:: only opening and waiting...
start /W notepad %1

start /W regedit /S %_npf1%
del %_npf1%
del %_npf2%

set _npf1=
set _npf2=

goto _HELL
:_NOTFOUND
echo Error: %1 not found
echo.

:_USAGE
echo NOTEPR.BAT v0.1 by ruul morawetz
echo prints ascii/text files via notepad to default printer
echo.
echo Usage: %~n0 FILENAME
echo.

:_HELL
:: END NOTEPR.BAT
=============== end copy/paste

What it does is to create a .reg file, and calls regedit to merge without prompting the contents to the registry to rewrite the notepad defaults.

Rather than do the whole batch file each time, run it once, adjust your Notepad settings and save a scratch file to force the registry write of font settings.

then use regedit to export the key: "HKEY_CURRENT_USER\Software\Microsoft\Notepad"

You batch file or logon script need only contain the line:

regedit /s exported_registry_key.reg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top