Jump to content
Sign in to follow this  

Changing Notepad's Font via a script

Recommended Posts

I've got a script which is opening .txt reports in notepad. I'm curious if anyone knows of a parameter or something which I can force a specific font and font size since these reports need to be viewed with Lucidia Console @ 7 point.



Share this post

Link to post
Share on other sites

Welcome to the forum.

I would have posted this last night, but the forum went down.

You could just open notepad and set the font as desired...

...then close notepad and open the report of interest.

You should only have to set the font once per computer, but it takes so little time, you could just do it every time via your script. You might want to also consider setting it back to what ever font settings were present before your script ran.

Opt("WinWaitDelay", 1)

Run("notepad", '', @SW_SHOW)
WinWait("Untitled - Notepad")
WinMenuSelectItem("Untitled - ", "", "F&ormat", "&Font")

WinWait("Font", "Cancel")
;WinSetState("Font", "Cancel", @SW_HIDE)

ControlSetText("Font", "Cancel", "Edit1", "Lucida Console")
ControlSetText("Font", "Cancel", "Edit2", "Regular")
ControlSetText("Font", "Cancel", "Edit3", "7")
ControlClick("Font", "Cancel", "Button5")

WinClose("Untitled - Notepad")
...as you can see, I have the @SW_SHOW on the run line. I was messing with doing it all while the window was hidden. I'm not sure that you can do all of it without a flash of the font window.


Share this post

Link to post
Share on other sites

@herwasplato's script probably works fine. But Notepad saves the value in the registry so a more reliable approach would probably be to change it there? Lurke it out with regmon from the company formerly known as www.sysinternals.com. Filter on notepad. And do the change a few times in a notepad session.

Just my two cents..:P

Share this post

Link to post
Share on other sites

Encase anyone else needs this ... Notepad settings are stored at:


And below are the options:

"lfFaceName"="Lucida Console"


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...