Jump to content

Recommended Posts

Posted

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.

Thanks,

MePH

Posted

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.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Posted

@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

Posted

...Notepad saves the value in the registry...

...sure, take the easy route :-)

@MePH,

Yep, that is a much better method.

...had I only know, now if I can only remember... MSP

[size="1"][font="Arial"].[u].[/u][/font][/size]

Posted

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

HKEY_CURRENT_USER\Software\Microsoft\Notepad

And below are the options:

"lfEscapement"=dword:00000000
"lfOrientation"=dword:00000000
"lfWeight"=dword:00000190
"lfItalic"=dword:00000000
"lfUnderline"=dword:00000000
"lfStrikeOut"=dword:00000000
"lfCharSet"=dword:00000000
"lfOutPrecision"=dword:00000003
"lfClipPrecision"=dword:00000002
"lfQuality"=dword:00000001
"lfPitchAndFamily"=dword:00000031
"iPointSize"=dword:00000046
"fWrap"=dword:00000000
"StatusBar"=dword:00000000
"fSaveWindowPositions"=dword:00000000
"lfFaceName"="Lucida Console"
"szHeader"=""
"szTrailer"=""
"iMarginTop"=dword:000000fa
"iMarginBottom"=dword:000000fa
"iMarginLeft"=dword:000000fa
"iMarginRight"=dword:000000fa
"fMLE_is_broken"=dword:00000000
"iWindowPosX"=dword:fffffd44
"iWindowPosY"=dword:00000111
"iWindowPosDX"=dword:000001d6
"iWindowPosDY"=dword:000001ec

MePH

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...