Sign in to follow this  
Followers 0
E1M1

Is it possible to increase and decrease font size for given edit

13 posts in this topic

Is it possible to increase and decrease font size for given edit? I want script to decrease or increase font for notepad's edit control.I prefer do it without any automated clicks.


edited

Share this post


Link to post
Share on other sites



$EM_SETCHARFORMAT? GuiCtrlSetFont?

Share this post


Link to post
Share on other sites

$EM_SETCHARFORMAT? GuiCtrlSetFont?

GuiCtrlSetFont sets font for gui that is generated by running autoit script, but notepad is not generated by autoit, notepad is made by Bill Gates and his team :P


edited

Share this post


Link to post
Share on other sites

notepad is made by Bill Gates and his team :D

:( I wont use notepad anymore, its easy to crack :D

Buy notepad premium, only 500$ :P:unsure:

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

I made something up but it seems like it dosn't work

#Include <WinAPI.au3>
#include <FontConstants.au3>
$hFont = _WinAPI_CreateFont(14, 0, 0, 0, "FW_DONTCARE", False, False, False, $DEFAULT_CHARSET, _
        $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial')
_WinAPI_PostMessage("[CLASS:Edit; INSTANCE:1]", "WM_SETFONT", "WPARAM ("&$hFont&")", True)

edited

Share this post


Link to post
Share on other sites

I made something up but it seems like it dosn't work

#Include <WinAPI.au3>
#include <FontConstants.au3>
$hFont = _WinAPI_CreateFont(14, 0, 0, 0, "FW_DONTCARE", False, False, False, $DEFAULT_CHARSET, _
        $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial')
_WinAPI_PostMessage("[CLASS:Edit; INSTANCE:1]", "WM_SETFONT", "WPARAM ("&$hFont&")", True)
$FW_DONTCARE = 0

$WM_SETFONT = 0x0030

not

"FW_DONTCARE" and "WM_SETFONT" and after use $hFont use _WinAPI_DeleteObject($hFont)


When the words fail... music speaks

Share this post


Link to post
Share on other sites

Ugly but work:

AutoItSetOption("WinTitleMatchMode",2)
Run("notepad.exe")
WinWait("Notepad")
ControlSend("Notepad","","Edit1","This is a test")
Sleep(3000)
WinMenuSelectItem("Notepad","","F&ormat","&Font...")
ControlSetText("Font","","Edit3","20")
ControlClick("Font","","Button5")

When the words fail... music speaks

Share this post


Link to post
Share on other sites

It seems like I've done something wrong, it still wont work.

#Include <WinAPI.au3>
#include <FontConstants.au3>
$WM_SETFONT = 0x0
$hFont = _WinAPI_CreateFont(14, 0, 0, 0, $FW_DONTCARE = 0, False, False, False, $DEFAULT_CHARSET, _
        $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, 'Arial')
_WinAPI_PostMessage("[CLASS:Edit; INSTANCE:1]", $WM_SETFONT = 0x0030, $hFont, True)
_WinAPI_DeleteObject($hFont)

edited

Share this post


Link to post
Share on other sites

Ugly but work:

AutoItSetOption("WinTitleMatchMode",2)
Run("notepad.exe")
WinWait("Notepad")
ControlSend("Notepad","","Edit1","This is a test")
Sleep(3000)
WinMenuSelectItem("Notepad","","F&ormat","&Font...")
ControlSetText("Font","","Edit3","20")
ControlClick("Font","","Button5")
it works but I need speed so I need to sent direct command(message) to edit control or modify memory address (last option is hard like hell)

edited

Share this post


Link to post
Share on other sites

#include <FontConstants.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Run('Notepad.exe')
WinWaitActive('Untitled')

Dim $hEdit = ControlGetHandle('Untitled', '', 'Edit1')
Dim $hFont = _WinAPI_CreateFont(-13, 0, 0, 0, 400, 0, 0, 0, 0, _
        $OUT_STROKE_PRECIS, $CLIP_STROKE_PRECIS, $DRAFT_QUALITY, 18, 'Castellar')

Dim $hDC = _WinAPI_GetDC($hEdit)
Dim $hOldFont = _WinAPI_SelectObject($hDC, $hFont)
;_WinAPI_PostMessage($hEdit, $WM_SETFONT, $hFont, True)
ControlSend('Untitled', '', 'Edit1', 'String')
_WinAPI_SelectObject($hDC, $hOldFont)
_WinAPI_DeleteObject($hFont)

Isn't it pretty?

Share this post


Link to post
Share on other sites

for me it does nothing else than just typing some text into notepad.


edited

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

I don't know why it's not working for you, I may guess you don't have this font. Or maybe your locale isn't english?

Edited by Authenticity

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

I don't know why it's not working for you, I may guess you don't have this font. Or maybe your locale isn't english?

I have this font +english locale.

There should be way to communicate with notepad as font window does.

I am wondering how it can be so hard to modify simple edit control.

I dont know if this is possible and if it is good idea but what about write dll (c++) and inject it in notepad?

Edited by E1M1

edited

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  
Followers 0