Syed23 Posted August 24, 2011 Posted August 24, 2011 Hi All, Currently i am playing with GUICtrlEdit function. I have a function which will checked for the application available, if the application is available then it will return Check passed in "Green Color" if the application is not present then it should return in red color... But i think the function which i am using "GUICtrlSetColor" is overrites for the complete Edit box based on the last control. For example if my last test condition that is application is available in my machine then the complete edit box appears in Green color... where i already have some entry in RED. Any idea to do it in better way? expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include "_XMLDomWrapper.au3" #include"Array.au3" Global $file, $numberOfChannels , $Comment, $RegKey Example() Func Example() Local $myedit, $msg GUICreate("My GUI edit") ; will create a dialog box that when displayed is centered $myedit = GUICtrlCreateEdit ("0"&@CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_WANTRETURN) GUISetState() Send("{END}") $file = _XMLFileOpen(@DesktopDir &"\sample.xml") ; Here i am opening the XML File $numberOfChannels = _XMLGetNodeCount("/root/Application") ; I am counting the number of Application nodes For $s = 1 To $numberOfChannels Step +1 $Comment = _XMLGetChildText("/root/Application[" & $s & "]/Name") ; getting the text of the node Name $RegKey = _XMLGetChildText("/root/Application[" & $s & "]/Location") If FileExists($RegKey[1]) Then GUICtrlSetData($myedit, "Check Passed: " & $Comment[1] & @CRLF) ; The return value will be array so i am using $comment[1] GUICtrlSetColor($myedit, 0x008000) Else GUICtrlSetData($iMemo,"Check Failed: " & $Comment[1]) GUICtrlSetColor($iMemo, 0xFF0000) EndIf Next ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() EndFunc ;==>Example Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
Moderators Melba23 Posted August 24, 2011 Moderators Posted August 24, 2011 Syed23, You may find this post of interest. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Syed23 Posted August 24, 2011 Author Posted August 24, 2011 (edited) quote name='Melba23' timestamp='1314184644' post='921231'] Syed23, You may find this post of interest. M23 Edited August 24, 2011 by Syed23 Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
Moderators Melba23 Posted August 24, 2011 Moderators Posted August 24, 2011 Syed23,Do you get those errors when you just run the RichEdit example code in the post I linked to? Where do all those other #include files come from? Those examples are stand-alone and were intended to give you an idea of what you need to do to get different coloured lines into a control. You cannot just plug that code into your existing script and expect it to work. Post the code which is giving you all those errors and I will take a look. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Syed23 Posted August 24, 2011 Author Posted August 24, 2011 quote name='Melba23' timestamp='1314187158' post='921248'] Syed23, Do you get those errors when you just run the RichEdit example code in the post I linked to? Where do all those other #include files come from? Those examples are stand-alone and were intended to give you an idea of what you need to do to get different coloured lines into a control. You cannot just plug that code into your existing script and expect it to work. Post the code which is giving you all those errors and I will take a look. M23 Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
Moderators Melba23 Posted August 24, 2011 Moderators Posted August 24, 2011 Syed23, What version of AutoIt are you running? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Syed23 Posted August 24, 2011 Author Posted August 24, 2011 Syed23,What version of AutoIt are you running? M233.3.6.1 Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
Moderators Melba23 Posted August 24, 2011 Moderators Posted August 24, 2011 Syed23,All those functions that are giving you "undefined function" are in the current release (and Beta) GUIRichEdit.au3 include file - so I have no idea why you get these errors. Do you run a standard AutoIt install? Have you any "amended" include files? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Syed23 Posted August 24, 2011 Author Posted August 24, 2011 quote name='Melba23' timestamp='1314188466' post='921259'] Syed23, All those functions that are giving you "undefined function" are in the current release (and Beta) GUIRichEdit.au3 include file - so I have no idea why you get these errors. Do you run a standard AutoIt install? Have you any "amended" include files? M23 Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
Moderators Melba23 Posted August 24, 2011 Moderators Posted August 24, 2011 Syed23, Firstly - stop repeating my previous post every time you reply. And if you feel you must quote me, please get the quote tags correct! Now to your script. We have been discussing RichEdit controls and yet you seem surprised that the control you create with: GUICtrlCreateEdit (""&@CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_WANTRETURN) does not respond to functions from the RichEdit UDF. Did you look at in the Help file to see the available functions within that UDF? I think not or you would have noticed that there is a _GUICtrlRichEdit_Create function - which might have given you a clue that you need a RichEdit control to interact with the RichEdit UDF. So here is your script adjusted to use a RichEdit control - if you use the correct #include files ( ) it should work for you as it does for me: expandcollapse popup#include <GuiRichEdit.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <StaticConstants.au3> #include "_XMLDomWrapper.au3" #include "Array.au3" Global $file, $numberOfChannels, $Comment, $RegKey Example() Func Example() Local $myedit, $msg $hGUI = GUICreate("My GUI edit", 500, 500) ; will create a dialog box that when displayed is centered ;$myedit = GUICtrlCreateEdit("" & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL + $ES_MULTILINE + $ES_WANTRETURN) $myedit = _GUICtrlRichEdit_Create($hGUI, @CRLF, 10, 10, 480, 480, BitOr($ES_AUTOVSCROLL, $WS_VSCROLL, $ES_MULTILINE)) GUISetState() $file = _XMLFileOpen(@DesktopDir & "\sample.xml") ; Here i am opening the XML File $numberOfChannels = _XMLGetNodeCount("/root/Application") ; I am counting the number of Application nodes For $s = 1 To $numberOfChannels $Comment = _XMLGetChildText("/root/Application[" & $s & "]/Name") ; getting the text of the node Name $RegKey = _XMLGetChildText("/root/Application[" & $s & "]/Location") If FileExists($RegKey[1]) Then _GUICtrlRichEdit_WriteLine($myedit, $Comment[1] & @CRLF, 0, "", 0x008000) Else _GUICtrlRichEdit_WriteLine($myedit, $Comment[1] & @CRLF, 0, "", 0x00FF00) EndIf Next ; Run the GUI until the dialog is closed While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then ExitLoop WEnd _GUICtrlRichEdit_Destroy($hGUI) GUIDelete() EndFunc ;==>Example Func _GUICtrlRichEdit_WriteLine($hWnd, $sText, $iIncrement = 0, $sAttrib = "", $iColor = -1) ; Count the @CRLFs StringReplace(_GUICtrlRichEdit_GetText($hWnd, True), @CRLF, "") Local $iLines = @extended ; Adjust the text char count to account for the @CRLFs Local $iEndPoint = _GUICtrlRichEdit_GetTextLength($hWnd, True, True) - $iLines ; Add new text _GUICtrlRichEdit_AppendText($hWnd, $sText & @CRLF) ; Select text between old and new end points _GUICtrlRichEdit_SetSel($hWnd, $iEndPoint, -1) ; Convert colour from RGB to BGR $iColor = Hex($iColor, 6) $iColor = '0x' & StringMid($iColor, 5, 2) & StringMid($iColor, 3, 2) & StringMid($iColor, 1, 2) ; Set colour If $iColor <> -1 Then _GUICtrlRichEdit_SetCharColor($hWnd, $iColor) ; Set size If $iIncrement <> 0 Then _GUICtrlRichEdit_ChangeFontSize($hWnd, $iIncrement) ; Set weight If $sAttrib <> "" Then _GUICtrlRichEdit_SetCharAttributes($hWnd, $sAttrib) ; Clear selection _GUICtrlRichEdit_Deselect($hWnd) EndFunc ;==>_GUICtrlRichEdit_WriteLine A few other changes: 1. Use BitOR to define multiple styles - look at the Setting Styles tutorial in the Wiki to find out why. 2. You can simplify the _GUICtrlRichEdit_WriteLine calling lines. The "-6" and "-bo" parameters change the font size and attributes - as you do not want to do this you can leave them both blank. 3. Note you need to destroy the RichEdit control before deleting the GUI - if not AutoIt will crash. All clear now? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Syed23 Posted August 24, 2011 Author Posted August 24, 2011 This is more than Clear and everything works awesome ! Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]
Moderators Melba23 Posted August 24, 2011 Moderators Posted August 24, 2011 Syed23, Glad we got it working for you. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Valuater Posted August 24, 2011 Posted August 24, 2011 My Favorite...expandcollapse popup#include <IE.au3> ;#include-once Global $XT_oIE XSkinConsole( "", 10, 10, 400, 300) XSkinText("This is an example...") Sleep(1000) XSkinText("Starting tasks...") Sleep(1000) XSkinText() ; sends a blank line XSkinText("... Clearing Screen") Sleep(700) XSkinText("CLR") ;Clears the XSkinConsole $Text = StringSplit("Checking System...,System Located,Checking Folders...,Folders Found,Checking Files...,Files Found, Verifying Data....,....Complete",",") $color = StringSplit("red,brown,orange,blue,yellow,green,gray,",",") For $i = 1 To $Text[0] -1 Sleep(1000) $msg = $i & @TAB & $Text[$i] XSkinText($msg, $color[$i]) Next Sleep(700) XSkinText() ; send a blank line XSkinText($Text[8], "Red", 6) Sleep(5000) Func XSkinConsole($XT_GUI, $left, $top, $width, $height) _IEErrorHandlerRegister() $XT_oIE = _IECreateEmbedded() If Not IsHWnd($XT_GUI) Then $XT_GUI = GUICreate("", $width + (2 * $left), $height + (2 * $top)) GUISetState() EndIf $XT_ActiveX = GUICtrlCreateObj($XT_oIE, $left, $top, $width, $height) _IENavigate($XT_oIE, "about:blank") Return $XT_ActiveX EndFunc ;==>XSkinConsole Func XSkinText($msg = "", $color = "black", $size = "3") If $msg == "CLR" Then Return _IEDocWriteHTML($XT_oIE, "") Return _IEDocWriteHTML($XT_oIE, _IEDocReadHTML($XT_oIE) & '<font color="' & $color & '" size=' & $size & '>' & $msg & '</font><br>') EndFunc ;==>XSkinText8)
Moderators Melba23 Posted August 24, 2011 Moderators Posted August 24, 2011 Valuater,As my Foreign Office friends used to say: Mandy Rice-Davies! Look for the quote in para 4 to see why. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Valuater Posted August 24, 2011 Posted August 24, 2011 Everyone likes a little piece of ass now and then. 8)
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