What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [SOLVED] Remove HTML Content

[SOLVED] Remove HTML Content
Author: Message:
markee
Veteran Member
*****

Avatar

Posts: 1622
Reputation: 50
36 / Male / Flag
Joined: Jan 2006
RE: [?] Remove HTML Content
I did something like this with my Message Converter script if you have a look.  It isn't the easiest of things but here is an extract of what I did.

code:
[...]
var bb = /\[b\]/gi;
var eb = /\[\/b\]/gi;
[...]
function OnEvent_ChatWndSendMessage(ChatWnd,Message){
        while ((arr = eb.exec(Message)) != null){
        var prev = RegExp.leftContext;
        var MessageEnd = RegExp.rightContext;
        Inner3:
        while ((arr1 = bb.exec(prev)) != null){
            var extract = RegExp.rightContext;
            var MessageBeg = RegExp.leftContext;
            if (eb.exec(extract)!=null){
                prev = MessageBeg;
                while(bb.exec(prev)!=null){
                }
                continue Inner3;
            }
        }
        Message = MessageBeg+""+extract+""+MessageEnd;
        while(eb.exec(Message)!=null){
        }
        continue Outer3;
    }

[...]
    return Message;
}

There are probably some better ways of going about some of the things but I know this works as a starting point.  This extract just finds the last instance of [/b] and finds the corresponding [b ] and will exclude any full [b ]...[/ b] in the middle(EDIT: relised it didn't so this, only the colour and background parts did as the likes of bolding doesn't need to be, though i should really check for any and make them not do anything rather than add 2 pointless characters) and replaces the beginning and end with the bold and ending of the bold for IRC style.  I hope this helps and if you need any help understanding my code then you can add me the WLM.

EDIT2: as I look over the code again, I probably don't need the continues in there as it should do the same thing with or without them there. Sorry for the edits btw.
* markee writes a mental note about his dodgy scripting ability

This post was edited on 12-03-2006 at 03:52 PM by markee.
[Image: markee.png]
12-03-2006 03:39 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[SOLVED] Remove HTML Content - by Spunky on 12-03-2006 at 03:23 PM
RE: [?] Remove HTML Content - by markee on 12-03-2006 at 03:39 PM
RE: [?] Remove HTML Content - by Spunky on 12-03-2006 at 04:30 PM
RE: [SOLVED] Remove HTML Content - by -dt- on 12-03-2006 at 05:10 PM
RE: RE: [SOLVED] Remove HTML Content - by markee on 12-04-2006 at 12:15 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On