headache: Special characters. |
Author: |
Message: |
runarius
New Member
Posts: 12
Joined: Jul 2007
|
O.P. RE: headache: Special characters.
couldn't figure out much from that... tried using it, but I cannot write those characters in the script so I have no way of searching through the string which holds the nickname in an attempt to replace the symbols by something else.
here is the code:
code: function AddLineToFile (file, line) {
if (!fsObj.FileExists(MsgPlus.ScriptFilesPath + '\\' + file))
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 2, 1);
else
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 8, 0);
fileObj.WriteLine(line);
fileObj.Close();
}
I'm starting to think it is not possible to do this. Since scripts doesn't support these characters, how could it possibly save them?
This post was edited on 07-23-2007 at 12:04 PM by runarius.
|
|
07-23-2007 11:26 AM |
|
|
davidpolitis
Full Member
Posts: 371 Reputation: 16
Joined: Aug 2006
|
RE: headache: Special characters.
You could try this, don't think it will work but its cleaner and nicer...
code: function AddLineToFile (file, line)
{
if (!fsObj.FileExists(MsgPlus.ScriptFilesPath + '\\' + file))
{
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 2, 1);
}
else
{
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, 8, 0);
fileObj.WriteLine(MsgPlus.RemoveFormatCodes(line));
fileObj.Close();
}
}
Also, if you wanted to just replace some characters, you could try
code: str.replace(/CharacterToReplace/, "NewCharacter");
Sorry, don't think I can really help you anymore.
This post was edited on 07-23-2007 at 11:59 AM by davidpolitis.
|
|
07-23-2007 11:42 AM |
|
|
Deco
Full Member
Posts: 188 Reputation: 4
42 / /
Joined: Aug 2006
|
RE: headache: Special characters.
Have you tried the RemoveFormatCodes function?
It's in the scripting documentation.
Have fun!
|
|
07-23-2007 01:40 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: headache: Special characters.
® is the registered trademark character it isn't a Plus! Character used for formatting.
People if you don't know what you are talking about don't post as you are only going to confuse things.
What is the error message in the debug window?
Can you post the exact name of the contact from the Contact Information Window (in a conversation type /info or from the Contact List right click the contact choose Messenger Plus! Extras > Contact Information)
My code works without a problem
code: function OnEvent_Initialize(MessengerStart){
//loop through the contacts
for (var e = new Enumerator(Messenger.MyContacts); !e.atEnd(); e.moveNext()){
// write the contacts name to the file test.txt in the scripts path
AddLineToFile ('test.txt', e.item().Name);
}
}
function AddLineToFile (file, line) {
// declare fsObj has FilesystemObject
var fsObj = new ActiveXObject('Scripting.FileSystemObject');
//check if the file exists already
var fileexists = fsObj.FileExists(MsgPlus.ScriptFilesPath + '\\' + file);
//open the file
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, (fileexists ? 8 : 1), true, (-1) /* UNICODE */);
//try to write the name to the file
try { fileObj.WriteLine(line); }
catch (err) {
//Oops we have an error lets output the name and the error
Debug.Trace(line);
Debug.Trace(err.description);
}
//close the file
fileObj.Close();
//unset the fsObj
fsObj = null;
}
This post was edited on 07-23-2007 at 02:16 PM by matty.
|
|
07-23-2007 01:44 PM |
|
|
runarius
New Member
Posts: 12
Joined: Jul 2007
|
O.P. RE: headache: Special characters.
tried to post his name here but just got this:
Қ®‬‬‬‬‬‬‬‭‌‍istoҒҒer
looks like alot of rubbish... Anyway, it is suppose to spell Kristoffer, but it has a special K,R,I and F's. I figured out a way to turn them into normal characters. The only problem is I have to find a list over ALL symbols not supported and throw them into my script. hmm... sounds like a big job.
This post was edited on 07-23-2007 at 02:43 PM by runarius.
|
|
07-23-2007 02:37 PM |
|
|
MeEtc
Patchou's look-alike
In the Shadow Gallery once again
Posts: 2200 Reputation: 60
38 / /
Joined: Nov 2004
Status: Away
|
RE: headache: Special characters.
code: javascript:document.write("Қ%C2%AE‬‬‬‬‬‬‬‭‌‍istoҒҒer");
put that in the address bar to view the funky chars
I cannot hear you. There is a banana in my ear.
|
|
07-23-2007 02:44 PM |
|
|
runarius
New Member
Posts: 12
Joined: Jul 2007
|
O.P. RE: headache: Special characters.
uhm... it seems that there is alot of characters inbetween the R and the I or something? wtf?
This post was edited on 07-23-2007 at 03:05 PM by runarius.
|
|
07-23-2007 02:57 PM |
|
|
matty
Scripting Guru
Posts: 8336 Reputation: 109
39 / /
Joined: Dec 2002
Status: Away
|
RE: headache: Special characters.
Oops matty made a mistake of his own...
code: function OnEvent_Initialize(MessengerStart){
//loop through the contacts
for (var e = new Enumerator(Messenger.MyContacts); !e.atEnd(); e.moveNext()){
// write the contacts name to the file test.txt in the scripts path
AddLineToFile ('test.txt', e.item().Name);
}
}
function AddLineToFile (file, line) {
// declare fsObj has FilesystemObject
var fsObj = new ActiveXObject('Scripting.FileSystemObject');
//check if the file exists already
var fileexists = fsObj.FileExists(MsgPlus.ScriptFilesPath + '\\' + file);
//open the file
var fileObj = fsObj.OpenTextFile(MsgPlus.ScriptFilesPath + '\\' + file, (fileexists ? 8 : 2 /* Previously was set to 1 which is ForReading */), true, (-1) /* UNICODE */);
//try to write the name to the file
try { fileObj.WriteLine(line); }
catch (err) {
//Oops we have an error lets output the name and the error
Debug.Trace(line);
Debug.Trace(err.description);
}
//close the file
fileObj.Close();
//unset the fsObj
fsObj = null;
}
This post was edited on 07-23-2007 at 04:29 PM by matty.
|
|
07-23-2007 03:56 PM |
|
|
runarius
New Member
Posts: 12
Joined: Jul 2007
|
O.P. RE: headache: Special characters.
anybody that has a solution to this one?
|
|
07-23-2007 04:18 PM |
|
|
Voldemort
Veteran Member
Posts: 3504 Reputation: 49
– / – /
Joined: Jul 2005
Status: Away
|
RE: headache: Special characters.
He corrected it already? see post above yours
*All posts are a purely speculative hypothesis based on abstract reasoning.
Not my daughter, you bitch!
|
|
07-23-2007 04:21 PM |
|
|
Pages: (3):
« First
«
1
[ 2 ]
3
»
Last »
|
|