What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Skype & Live Messenger » Fast way to add multiple contacts

Fast way to add multiple contacts
Author: Message:
AberNStein
Full Member
***


Posts: 132
Reputation: 2
Joined: Jul 2006
RE: Fast way to add multiple contacts
i knocked up a quick little jscript to do it. i couldn't figure out how to read the number of lines in a file, so you'll have to input that too.
code:
var fso, f1, ts, final;
fso = new ActiveXObject("Scripting.FileSystemObject");
var ForReading = 1;

function MakeCList(theFile,theNewFile,numContacts)
{
var final = '<?xml version="1.0"?>';
final += '<messenger>';
final += '<service name=".NET Messenger Service">';
final += '<contactlist>';
ts = fso.OpenTextFile(theFile, ForReading);
for (i=0; i<numContacts; i++)
{
final+='<contact type="1">' + ts.ReadLine() + '</contact>';
}
ts.Close();
final += '</contactlist>';
final += '</service>';
final += '</messenger>';
f1 = fso.CreateTextFile(theNewFile, true);
f1.Write (final);
f1.Close();
}

MakeCList("C:\\contacts.txt","C:\\contacts.ctt",10);

the syntax is MakeCList("[path to file with email addresses]","[path to new contacts.ctt]", [number of email addresses]);

obviously this assumes one email address per line. if they were comma seperated it would be really easy.

edit:
code:
var fso, f1, ts, final, a;
fso = new ActiveXObject("Scripting.FileSystemObject");
var ForReading = 1;

function MakeCList(theFile,theNewFile)
{
var final = '<?xml version="1.0"?>';
final += '<messenger>';
final += '<service name=".NET Messenger Service">';
final += '<contactlist>';
ts = fso.OpenTextFile(theFile, ForReading);
a=ts.ReadAll().split(",");
for (i=0; i<a.length; i++)
{
a[i]=a[i].replace(" ","");
final+='<contact type="1">' + a[i] + '</contact>';
}
ts.Close();
final += '</contactlist>';
final += '</service>';
final += '</messenger>';
f1 = fso.CreateTextFile(theNewFile, true);
f1.Write (final);
f1.Close();
}

MakeCList("C:\\contacts.txt","C:\\contacts.ctt");

that's for comma separated or comma space separated. doesn't need to know the number of addresses.

This post was edited on 07-14-2006 at 01:04 AM by AberNStein.
[Image: gybouserbar6hc.gif]
07-14-2006 12:59 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Fast way to add multiple contacts - by alegator on 07-13-2006 at 11:01 PM
RE: Fast way to add multiple contacts - by Jimcando on 07-13-2006 at 11:27 PM
RE: Fast way to add multiple contacts - by alegator on 07-14-2006 at 12:23 AM
RE: Fast way to add multiple contacts - by Jimcando on 07-14-2006 at 12:24 AM
RE: Fast way to add multiple contacts - by AberNStein on 07-14-2006 at 12:59 AM
RE: Fast way to add multiple contacts - by alegator on 07-14-2006 at 01:05 AM
RE: Fast way to add multiple contacts - by AberNStein on 07-14-2006 at 01:14 AM
RE: Fast way to add multiple contacts - by alegator on 07-14-2006 at 02:32 AM
RE: RE: Fast way to add multiple contacts - by AberNStein on 07-14-2006 at 03:12 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