What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Help] Need help with list of files in array...

[Help] Need help with list of files in array...
Author: Message:
b0rna
New Member
*


Posts: 11
Joined: Jun 2006
O.P. [Help] Need help with list of files in array...
Hi!

im writing a file server script for the new plus, sorta like the xdcc in irc, where the user can see a list of files in the chat windows and request them and they will be sent to them through the chat like a normal file transfer.

I have dumped file names, paths, attributes, etc... in arrays and i want to send a rather large number of files to choose from to the user.

now msn has a maximum amount of characters and lines that can be sent per message, lets say there are 100 music files in my array.

if i use the SendMessage command and give it my array as the parameter, this is what the message will look like:

D:\Music\Music\#04 - Creed - With Arms Wide Open.mp3,D:\Music\Music\(01) Justin Timberlake - Senorita.wma,D:\Music\Music\(09) Joe Budden - Fire (ft. Busta Rhymes).wma,D:\Music\Music\(10) Andre 3000 - Roses.wma,D:\Music\Music\(10) Tyrese - all ghetto ...
and etc...

now removing the paths and numbering the files all that i will do later on.

my question is, how can output this array so that each file will come on a new line and they will all be sent in one message, untill the capacity of that message is reached, and the rest follow in the next message...

sort of like this.

Example User Says:

D:\Music\Music\#04 - Creed - With Arms Wide Open
D:\Music\Music\(01) Justin Timberlake - Senorita.wma
D:\Music\Music\(09) Joe Budden - Fire.wma
D:\Music\Music\(10) Andre 3000 - Roses.wma
D:\Music\Music\(10) Tyrese - all ghetto

upto the maximum number of lines...

Example User Says:

and the rest of the files...


thank you.

This post was edited on 06-26-2006 at 07:07 AM by b0rna.
06-26-2006 07:04 AM
Profile E-Mail PM Find Quote Report
can16358p
Junior Member
**

WLM + MP!L User

Posts: 58
34 / Male / –
Joined: Oct 2005
Status: Away
RE: Need help with list of files in array...
I think max. number was 1100 chars. Let's consider it as that.

You may use a for loop. Or even two.
Make a for loop that will add the text (in this case file paths) to the message, and another for adding those messages to another array which contains the mesages to be sent.
Let sendstr be the message going to be sent.

More detailed step by step:
Make array of song names (you did this one)
Make another array which will hold the strings to be sent.
Make an empty string
Make a loop that will;
Check if the string + next item on the first array (the one with songs names) exceeds 1100 chars, if doesn't exceed, add the text (don't also forget to add line breaks etc.), if exceeds, put the string to the second array (messages to be sent/forget indexing, just use push method), empty the string, and continue the loop until the first array is empty.

Ok, now, read that sentence slowly :D

After this is easy, you'll just send the messages until the second array is empty, each item as one message.

This post was edited on 06-26-2006 at 07:16 AM by can16358p.
[Image: anathema.gif][Image: hax0r.png]
06-26-2006 07:15 AM
Profile E-Mail PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: [Help] Need help with list of files in array...
this is the method i use , just make it into one string and use this function


code:
/*
* ---------------------------
* Void sendPartedMessage (chatWnd wnd, String str, Int length)
* splits a string into parts (decided by length) and sends them
* by -dt-
* ----------------------------
*/
function sendPartedMessage(wnd, str,length){
    if(str.length > length){
        var part;
        while(str.length >= length){
            part = str.substr(0,length);
            str = str.substr(part.length);
            wnd.SendMessage(part);
        }
        wnd.SendMessage(str);
    }else{
        wnd.SendMessage(str);
    }
}

[Image: dt2.0v2.png]      Happy Birthday, WDZ
06-26-2006 07:30 AM
Profile PM Web Find Quote Report
b0rna
New Member
*


Posts: 11
Joined: Jun 2006
O.P. RE: [Help] Need help with list of files in array...
thank you both kindly workin on that now.

This post was edited on 06-26-2006 at 07:45 AM by b0rna.
06-26-2006 07:44 AM
Profile E-Mail PM Find Quote Report
mathieumg
Full Member
***


Posts: 181
Reputation: 2
35 / Male / Flag
Joined: May 2004
RE: [Help] Need help with list of files in array...
You might be interested by this: http://shoutbox.menthix.net/showthread.php?tid=61404
Official MessengerPlus! Live French Translator
Official StuffPlug 3 French Translator

:)
06-26-2006 11:46 AM
Profile E-Mail 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