Jump to content

[SOLVED] Multiple Color for Lines in Edit Boxes


Recommended Posts

Hi!

is it possible to color different lines in the edit boxes as the data is being added? You know, like MIRC does when you set y our own colors? Like, if $whoSent = "Someone" then COLOR line and input into edit box, this way I can see the persons color.

I wonder if that's possible?

Edited by zackrspv

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

It's possible, someone found a answer to this question, I even wanted to know, but I havn't seen them. It's possible, although I don't know how. (I wish I did... :) )

haha yeah, it would be great. Writing my IRC client that supports colors hehe

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

Awesome, I think i'd be cool to have a new IRC Cilent! :)

I have a sinking suspicion i have to use RichEdit boxes instead......man i hate making those haha

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

You don't have too.

hum, kk. well back to the grind on searching haha. Finally got the client up to display messages, now just have to color them and i'm done :)

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

Ok, well that works wonderfully. However, the only thing i'm having trouble with is that I'm using this to allow for colors while in the IRC client that i'm creating. However, since the window is an embeded IE window, when you add text to it, it automatically refreshes and goes back to the top of the page; how can i make it auto scroll?

#include <zirc.au3>
#include <INet.au3>
#include <GUIConstants.au3>
#include <IE.au3>
#include <Array.au3>
#include <file.au3>
#include <Date.au3>
#include <XSkin.au3>

Global $XT_oIE
$left = 0
$top = 0
$width = 1027
$height = 650
XSkinConsole( "Chat Client", $left, $top, $width, $height)
XSkinText("CLR") ;Clears the XSkinConsole
$input = GUICtrlCreateInput("", 0, 590, 500, 25)
$button = GuictrlcreateButton("Send", 510, 590, 55, 25, $GUI_SS_DEFAULT_BUTTON)
GUISetState(@SW_SHOW)

Global $server = "irc.dal.net"
Global $port = 6667
Global $nick = "Bot2"
Global $channel = "#MyChan"
$fQuery = ""
$quoteLastData = ""
$QuoteAfterHoursData = ""
$quoteAFUpDownStatus = ""
$Quotesource = ""
$quoteAFColor = ""
$quoteDelayColor = ""
$quoteAFStatus = ""



TCPStartup()
Global $sock = _IRCConnect($server, $port, $nick); Connects to IRC and Identifies its Nickname

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    
    case $button
        $msg = guictrlread($input, 1)
        _IRCSendMessage($sock, $msg, $channel)
        XSkinText("["&@hour&":"&@min&"] <"&$nick&"> "&$msg, 3)

        ;- Close the GUI
        Case $GUI_EVENT_CLOSE
            _IRCQuit($sock, "Done for the day!")
            Exit
        Case Else
            $recv = TCPRecv($sock, 8192); Recieve things from server
            If @error Then Exit MsgBox(1, "IRC Example", "Server has errored or disconnected"); If you can't recieve then the server must have died.
            Local $sData = StringSplit($recv, @CRLF); Splits the messages, sometimes the server groups them
            For $i = 1 To $sData[0] Step 1; Does each message seperately
                Local $sTemp = StringSplit($sData[$i], " "); Splits the message by spaces
                If Not $sData[$i] = "" Then
                    $noffset = 1
                    $data = StringRegExp($sData[$i], "(?i)(?s)(?:.*?)\*{3}\s(.*?)(?:\z)", 1, $noffset)
                    If @error = 1 Then
                        If StringInStr($sData[$i], "PRIVMSG", 0) Then
                            $data = StringRegExp($sData[$i], "(?i)(?s):(.*?)!(?:.*?):(.*?)(?:\z)", 1, $noffset)
                            if @error = 1 Then
                                Else
                                XSkinText("["&@hour&":"&@min&"] <"&$data[0] & "> "& $data[1],3)
                            EndIf
                            
                        Else
                            $data = StringRegExp($sData[$i], "(?i)(?s)(?:.*?):.*?:(.*?)(?:\z)", 1, $noffset)
                            if @error = 1 Then
                                Else
                                    XSkinText($data[0],3)
                            EndIf
                        EndIf
                    Else
                        XSkinText($data[0],3)
                    EndIf
                    
                    
                EndIf
                
                $noffset = 1
                If StringInStr($sData[$i], "!help", 0) Then
                    $fKBFindArray = StringRegExp($sData[$i], "(?i)(?s)(?:^.*):(.*?)(?:!help)(.*?)(?:\z)", 1, $noffset)
                    If $fKBFindArray[0] = "" Then
                        $fQuery = $fKBFindArray[1]
                        $queryUser = StringTrimLeft($sData[$i], 1)
                        $fqueryUser = StringRegExp($queryUser, "(?i)(?s)(.*?)!", 1, $noffset)
                        $whoSent = $fqueryUser[0]
                        _IRCSendMessage($sock, "Welcome to the Automated Information System.  The following are a list of commands that I accept:", $whoSent)
                        _IRCSendMessage($sock, "!KB    -- This allows you to search the kb for information.", $whoSent)
                        _IRCSendMessage($sock, "!Quote -- This allows you to get a quote on a symbol or option.", $whoSent)
                        _IRCSendMessage($sock, "!Help -- Shows this help section.", $whoSent)
                        _IRCSendMessage($sock, "---------------------------------------------------------------", $whoSent)
                        _IRCSendMessage($sock, "Examples: !kb RTM or !quote GOOG", $whoSent)
                    Else
                    EndIf
                    
                ElseIf StringInStr($sData[$i], "!KB ", 0) Then
                    $fKBFindArray = StringRegExp($sData[$i], "(?i)(?s)(?:^.*):(.*?)(?:!kb\s)(.*?)(?:\z)", 1, $noffset)
                    If $fKBFindArray[0] = "" Then
                        $fQuery = $fKBFindArray[1]
                        $queryUser = StringTrimLeft($sData[$i], 1)
                        $fqueryUser = StringRegExp($queryUser, "(?i)(?s)(.*?)!", 1, $noffset)
                        $whoSent = $fqueryUser[0]
                        Call("goCheckKB")
                    Else
                    EndIf
                    
                    
                ElseIf StringInStr($sData[$i], "!quote", 0) Then
                    $fKBFindArray = StringRegExp($sData[$i], "(?i)(?s)(?:^.*):(.*?)(?:!quote\s)(.*?)(?:\z)", 1, $noffset)
                    If $fKBFindArray[0] = "" Then
                        $symbol = $fKBFindArray[1]
                        $symbol = StringUpper($symbol)
                        If StringRegExp($symbol, "(?s)\s") Then
                            $symbol = StringReplace($symbol, " ", "") & ".x"
                        Else
                        EndIf
                        $queryUser = StringTrimLeft($sData[$i], 1)
                        $fqueryUser = StringRegExp($queryUser, "(?i)(?s)(.*?)!", 1, $noffset)
                        $whoSent = $fqueryUser[0]
                        
                        $Quoteurl = "http://finance.yahoo.com/q?s=" & $symbol
                        $Quotesource = _INetGetSource($Quoteurl)
                        if StringInStr($Quotesource, "PNK", 0) Then
                            $symbol = $symbol&".pk"
                        Else
                            EndIf
                        
                        Call("goQuotes")
                    Else
                    EndIf
                EndIf
                

                If $sTemp[1] = "" Then ContinueLoop; If its empty, Continue!
                If StringInStr($sTemp[1], "PING", 0) Then _IRCPing($sTemp[2]); Checks for PING replys (There smaller then usual messages so its special!
                If $sTemp[0] <= 2 Then ContinueLoop; Useless messages for the most part
                Switch $sTemp[2]; Splits the command msg
                    Case "266"; It's what I use as an indictator to show when its done sending you info.
                        _IRCJoinChannel($sock, $channel)
                        _IRCSendMessage($sock, "Hello!  BTC Bot is Ready.  Type !Help for a list of commands!", $channel)
                        _IRCChangeMode($sock, "+i", $nick)
                EndSwitch
            Next
    EndSwitch

WEnd
Edited by zackrspv

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

have a look at DaleHohm's solution in this post

Scrolling down an embedded IE

try using the Google advanced search of domain option

http://www.google.com/advanced_search?q=+s...&as_qdr=all

"_IEDocWriteHTML Scroll IE site:www.autoitscript.com/forum/"

awesome!

I adapted his and it's working wonderfully. I even added colors for certain chat names, :)

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...