tylerh27 Posted September 1, 2012 Share Posted September 1, 2012 I'm going to be getting text from a web server, and i'll receive something like: <font color="green">Username:</font> string for message Anyway, i wanna i wanna string replace the font tags, and make the actual text "Username" green when its displayed, but idk how to change colors. It will also be in an edit box "GuiCtrlCreateEdit" Can someone tell me how to make certain text green? Link to comment Share on other sites More sharing options...
kaotkbliss Posted September 1, 2012 Share Posted September 1, 2012 (edited) you could either create an array with the hex color and assign the word to a number say: Dim $color_array[3] $color_array[0] = 0x00FF00 $color_array[1] = 0x0000FF $color_array[2] = 0xFF0000 *edit* a better way to write the array: Local $color_array[3] = [0x00FF00,0x0000FF,0xFF0000] *end edit* then get your text from the web page and search for the color if $color = "green" then $i = 0 elseif $color = "blue" then $i = 1 elseif $color = "red" then $i = 2 etc. then you can use GUICtrlSetColor($Handle_to_Text, $color_array[$i]) Edited September 1, 2012 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
FireFox Posted September 1, 2012 Share Posted September 1, 2012 (edited) Hi, Here you go : #include <Array.au3> ConsoleWrite("red: " & _HTMLColorToHex("red") & @CRLF) ;decimal ConsoleWrite("red: 0x" & Hex(_HTMLColorToHex("red"), 6) & @CRLF) ;hex ;the hex color written in the array is converted to decimal Func _HTMLColorToHex($sHTMLColorToHex_HTMLColor) Local $aHTMLColorToHex_Color[3][2] = [ _ ;Don't forget to edit the size of the array [0xFF0000, "red"], _ [0xFFFFFF, "white"], _ [0x000000, "black"]] ;and so on Local $iHTMLColorToHex_ColorIndex = _ArraySearch($aHTMLColorToHex_Color, $sHTMLColorToHex_HTMLColor, 0, 0, 0, 0, 1, 1) If $iHTMLColorToHex_ColorIndex <> -1 Then Return $aHTMLColorToHex_Color[$iHTMLColorToHex_ColorIndex][0] Else Return -1 EndIf EndFunc ;==>_HTMLColorToHex Br, FireFox. Edited September 1, 2012 by FireFox Link to comment Share on other sites More sharing options...
PhoenixXL Posted September 2, 2012 Share Posted September 2, 2012 Can someone tell me how to make certain text green?Just making certain text of specific color is not possible in Edit controlsU should use RichEdit controls My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. 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