TheAutomator Posted February 4, 2014 Posted February 4, 2014 (edited) I don't know if I should post this question here or in the "GUI" section so please don't kill me if i'm wrong Its a simple question I think, but I cant find a solution.. There are some examples where you can change a control with AutoIt in 'Notepad.exe' using the ControlCommand() function. Is it also possible to change the color of the edit box in Notepad with AutoIt? Saw an example for changing the control text or the color of the menu but I can't find a way for doing this with the edit control of Notepad.exe. I'm searching something like this: Example() Func Example() ; Run Notepad Run("notepad.exe") ; Wait 10 seconds for the Notepad window to appear. Local $hWnd = WinWait("[CLASS:Notepad]", "", 10) ; Set the backgroundcolor of the Notepad edit control. ???($hWnd, "", 0x00FF00) EndFunc ;==>Example Is this possible? Thanks, TheAutomator Edited February 4, 2014 by TheAutomator Retro Console, NestedArrayDisplay UDF foldermaker-pro-clone MiniMark Editor
Moderators JLogan3o13 Posted February 4, 2014 Moderators Posted February 4, 2014 Must it be Notepad? Why not just create your own input context? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $msg GUICreate("Test", 300, 300) GUISetState(@SW_SHOW) $sText = GUICtrlCreateInput("", 10, 10, 280, 280) GUICtrlSetBkColor($sText, 0x00FF00) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd GUIDelete() "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
TheAutomator Posted February 4, 2014 Author Posted February 4, 2014 (edited) JLogan3o13, On 2/4/2014 at 12:46 AM, JLogan3o13 said: Must it be Notepad? Why not just create your own input context? Yes, I'd like to know if this is possible with Notepad I could create my own version of Notepad but I want to know if it is possible to change the color of any control for a windows program using the ControlCommand() function or something like that.. Thanks, TheAutomator Edited February 4, 2014 by TheAutomator Retro Console, NestedArrayDisplay UDF foldermaker-pro-clone MiniMark Editor
JohnOne Posted February 4, 2014 Posted February 4, 2014 If you cannot change it manually, I doubt you can programmatically. Upgrade to notepad++ AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Moderators JLogan3o13 Posted February 4, 2014 Moderators Posted February 4, 2014 On 2/4/2014 at 1:19 PM, AZJIO said: @TheAutomator '?do=embed' frameborder='0' data-embedContent>> tutorial - http://azjio.narod.ru/autoit3_docs/tutorials/Notepad.htm This is still creating a custom GUI and not changing the native Notepad app. If, as the OP stated, he doesn't want a custom GUI, then he will need to update to a better application as JohnOne suggested. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
AZJIO Posted February 4, 2014 Posted February 4, 2014 @JLogan3o13 Quote OP stated OP stated: Quote I could create my own version of Notepad but I want to know if it is possible to change the color of any control for a windows program About Notepad++, he did not speak. My other projects or all
Moderators JLogan3o13 Posted February 4, 2014 Moderators Posted February 4, 2014 Correct, he is saying he could create his own version of notepad, but does not want to. He reiterated this when I suggested a GUI with a custom input field. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
JohnOne Posted February 4, 2014 Posted February 4, 2014 Thought this might have been in with a shout... #include <WinAPI.au3> Run("notepad.exe") WinWaitActive("Untitled - Notepad") $whwnd = WinGetHandle("Untitled - Notepad") If @error Then Exit MsgBox(0,"error","WinGetHandle") EndIf _WinAPI_FlashWindow($whwnd) $chwnd = ControlGetHandle($whwnd, "", "[CLASS:Edit; INSTANCE:1]") If @error Then Exit MsgBox(0,"error","ControlGetHandle") EndIf $cDC = _WinAPI_GetDC($chwnd) If @error Then Exit MsgBox(0,"error","_WinAPI_GetDC") EndIf _WinAPI_SetBkColor($cDC, 0x0000ff00) If @error Then Exit MsgBox(0,"error","_WinAPI_SetBkColor") EndIf ;_WinAPI_RedrawWindow($whwnd) Does not work though. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
TheAutomator Posted February 4, 2014 Author Posted February 4, 2014 (edited) AZJIO, I have downloaded the "My_Notepad.7z". Nice program but not the answer on my question. JLogan3o13, Thank you for correcting some answers I got JohnOne, The script you posted indeed does not work but thanks for trying, its probably not possible I guess. TheAutomator. Edited February 4, 2014 by TheAutomator Retro Console, NestedArrayDisplay UDF foldermaker-pro-clone MiniMark Editor
BrewManNH Posted February 4, 2014 Posted February 4, 2014 The only way you can change the background color of notepad is to change the background color of all windows. There's no way to set it to a color without changing all other standard background colors. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! Reveal hidden contents I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator
TheAutomator Posted February 4, 2014 Author Posted February 4, 2014 (edited) BrewManNH, On 2/4/2014 at 5:30 PM, BrewManNH said: The only way you can change the background color of notepad is to change the background color of all windows. There's no way to set it to a color without changing all other standard background colors. Ok, the reason I questioned this is because in AutoIt scripts you can set the colors of the controls individually, I also saw an example for changing the color of the menu somewere (can't find it anymore, still searching...). Thanks, TheAutomator. Edited February 4, 2014 by TheAutomator Retro Console, NestedArrayDisplay UDF foldermaker-pro-clone MiniMark Editor
AZJIO Posted February 4, 2014 Posted February 4, 2014 Quote I also saw an example for changing the color of the menu somewere (can't find it anymore, still searching...). example in the help file _GUICtrlMenu_SetMenuBackground My other projects or all
TheAutomator Posted February 4, 2014 Author Posted February 4, 2014 AZJIO, On 2/4/2014 at 10:31 PM, AZJIO said: example in the help file _GUICtrlMenu_SetMenuBackground That's the one Thanks, TheAutomator. Retro Console, NestedArrayDisplay UDF foldermaker-pro-clone MiniMark Editor
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