E1M1 Posted March 13, 2009 Share Posted March 13, 2009 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 Link to comment Share on other sites More sharing options...
Authenticity Posted March 13, 2009 Share Posted March 13, 2009 $EM_SETCHARFORMAT? GuiCtrlSetFont? Link to comment Share on other sites More sharing options...
E1M1 Posted March 13, 2009 Author Share Posted March 13, 2009 $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 edited Link to comment Share on other sites More sharing options...
FireFox Posted March 13, 2009 Share Posted March 13, 2009 notepad is made by Bill Gates and his team I wont use notepad anymore, its easy to crack Buy notepad premium, only 500$ Cheers, FireFox. Link to comment Share on other sites More sharing options...
E1M1 Posted March 13, 2009 Author Share Posted March 13, 2009 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 Link to comment Share on other sites More sharing options...
Andreik Posted March 13, 2009 Share Posted March 13, 2009 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. Link to comment Share on other sites More sharing options...
Andreik Posted March 13, 2009 Share Posted March 13, 2009 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. Link to comment Share on other sites More sharing options...
E1M1 Posted March 13, 2009 Author Share Posted March 13, 2009 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 Link to comment Share on other sites More sharing options...
E1M1 Posted March 13, 2009 Author Share Posted March 13, 2009 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 Link to comment Share on other sites More sharing options...
Authenticity Posted March 13, 2009 Share Posted March 13, 2009 #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? Link to comment Share on other sites More sharing options...
E1M1 Posted March 13, 2009 Author Share Posted March 13, 2009 for me it does nothing else than just typing some text into notepad. edited Link to comment Share on other sites More sharing options...
Authenticity Posted March 13, 2009 Share Posted March 13, 2009 (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 March 13, 2009 by Authenticity Link to comment Share on other sites More sharing options...
E1M1 Posted March 14, 2009 Author Share Posted March 14, 2009 (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 March 14, 2009 by E1M1 edited Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now