What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Solved]Weird breakline problems

[Solved]Weird breakline problems
Author: Message:
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
31 / Male / Flag
Joined: Mar 2003
Status: Online
O.P. [Solved]Weird breakline problems
I want to pass a message received from a conversation to my DLL.
However, it seems that breaklines won't get passed to my DLL :-/
So if the message received contains breaklines, they won't reach my DLL...

So I thought, ok, let's try something else.
I thought of replacing the breaklines with something else (like <br> for example or something similar) and then send the message to my dll, and then my dll replaces again <br> to a breakline.

When I tried that, it didn't seem to work.
The breakline wasn't being replaced for some reason, and the message was still being shown with the breaklines instead of the replaced text...
So, I went to the irc scripting help channel, and asked if the code I was using was correct.
Let me post the whole part of the log regarding this:

quote:
Originally posted by #msgplus.script on msgplus.irc.net

[14:08:18] <Mike2> shouldn't this change all breaklines to <br> ?
[14:08:18] <Mike2> tmp = tmp.replace(/\n/g, "<br>");
[14:08:42] <borna> yes it should
[14:08:53] <Mike2> it doesn't work for me :/
[14:09:07] <Mike2> i do then Debug.Trace(tmp)
[14:09:12] <Mike2> but i still get breaklines
[14:09:30] <A06> tmp = tmp.replace('\\n', "<br>");
[14:09:51] <borna> try using 2 lines
[14:09:53] * Z1mmE has joined #msgplus.script
[14:10:01] * gifpaste sets mode: +l 36
[14:10:02] <borna> replace each with one line of code
[14:10:09] <Mike2> nope a06
[14:10:12] <Mike2> doesnt work :(
[14:10:20] <Mike2> what do you mean borna?
[14:10:31] <borna> well if what a06 said dont work than mine wont either
[14:10:37] * ZimmE has quit IRC (Ping timeout)
[14:10:55] <A06> tmp = tmp.replace("\\n", "<br>");
[14:11:16] <turex> mike help me
[14:11:42] <Mike2> doesnt work A06 :(
[14:12:34] * Guest44 has quit IRC (Quit: www.msgpluslive.net)
[14:12:36] <borna> what a06 said should definatly work
[14:13:05] * turex has quit IRC (Quit: )
[14:13:21] <Mike2> nope :S
[14:13:42] <borna> hmm
[14:13:45] <borna> ill try it for you
[14:13:55] <Mike2> ok, thanks :)
[14:13:55] <borna> where are you getting your string data
[14:13:55] * Z1mmE has quit IRC (Ping timeout)
[14:14:00] <borna> from btw
[14:14:02] * gifpaste sets mode: +l 32
[14:14:03] <A06> borna ;)
[14:14:08] <borna> yep
[14:14:10] <Mike2> from OnEvent_ChatWndReceiveMessage
[14:14:12] <borna> ^^
[14:14:13] <Mike2> the Message parametr
[14:16:37] <A06> tmp = tmp.replace(/\n/,"<br>");
[14:17:10] <Mike2> nope :s
[14:17:57] * Z1mmE has joined #msgplus.script
[14:19:32] <A06> hum
[14:19:53] <borna> the kids right
[14:19:54] <borna> i tried it
[14:20:06] <borna> well not the last one i tried the "\\n"
[14:20:14] <borna> that one dont work although it logically should
[14:20:49] <A06> yea
[14:21:06] <borna> and tmp = tmp.replace(/\n/,"<br>");
[14:21:11] <borna> no luck either
[14:21:12] <borna> thats odd
[14:21:18] <borna> wait wait
[14:21:32] <A06> tmp = MsgPlus.RemoveFormatCodes(tmp);
[14:21:37] <A06> tmp = tmp.replace(/\n/,"<br>");
[14:21:58] <borna> thats what i was gonna say
[14:22:03] <borna> use the plus remove format codes
[14:22:07] <borna> but that will remove everything
[14:22:20] <Mike2> but there are no format codes on my message :S
[14:22:24] <Mike2> but lets try that
[14:22:27] * [TnJ]Baffo has joined #msgplus.script
[14:22:29] <[TnJ]Baffo> hi
[14:23:15] <borna> or umm
[14:23:18] <Mike2> removing format codes didnt work
[14:23:19] <borna> cant you convert them
[14:23:22] <borna> into another type
[14:23:28] <borna> that should remove the \n i think too
[14:23:31] <borna> not so sure though
[14:24:02] * gifpaste sets mode: +l 34
[14:24:59] <Mike2> i still need the breakline
[14:25:03] <Mike2> just as some "text"
[14:25:07] <Mike2> you know what i mean right? :P
[14:25:16] <Mike2> it seems that when i pass the message to a dll i made
[14:25:22] <Mike2> breaklines are lost :/
[14:25:44] <Mike2> so i'm replacing them to something else
[14:25:57] <Mike2> and I will replace them again to breaklines in my dll
I tried what I had been suggested, but as you can see, it didnt work... :(
And as you can see, someone else tried, and he also couldn't get it working...

So is this a bug, or am I doing something wrong?

This post was edited on 06-29-2006 at 08:15 PM by Mike.
YouTube closed-captions ripper (also allows you to download videos!)
06-29-2006 05:06 PM
Profile E-Mail PM Web Find Quote Report
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Weird breakline problems
A line break can be many things, thus not only \n

You have ascii code 13 (Carriage Return), but also ascii code 10 (Line Feed), or a combination of the two: CRLF...




PS: a line break is a character like anything else and it should be able to be passed just as well without any workarounds. If you need such workarounds, maybe something else is wrong...

Before passing the line to your DLL, do a Debug.Trace of the actual string you're going to send. If that doesn't contain the multiple lines, then there is something wrong even before you send it to the DLL...

So all in all, this is mostlikely not a problem of the linefeeds or carriage returns not being passed, but probably an error in the routine you use to even get those lines in the first place.

This post was edited on 06-29-2006 at 05:21 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
06-29-2006 05:16 PM
Profile PM Find Quote Report
Mike
Elite Member
*****

Avatar
Meet the Spam Family!

Posts: 2795
Reputation: 48
31 / Male / Flag
Joined: Mar 2003
Status: Online
O.P. RE: Weird breakline problems
Yes, you were right...
There was something wrong with my DLL code...
Seems that I fixed it thought :)

Thanks. :)
YouTube closed-captions ripper (also allows you to download videos!)
06-29-2006 08:14 PM
Profile E-Mail PM Web Find Quote Report
RaceProUK
Elite Member
*****

Avatar

Posts: 6073
Reputation: 57
39 / Male / Flag
Joined: Oct 2003
RE: [Solved]Weird breakline problems
And the idea to use '\\n' was never going to work: it would replace the string '\n', not newlines.

As you're using regex, the following should work for all possible linebreaks: '(\n|\r)+'.
[Image: spartaafk.png]
06-29-2006 09:35 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »


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