What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » HELP - "foreach" command!

HELP - "foreach" command!
Author: Message:
SmokingCookie
Senior Member
****

Avatar

Posts: 815
Reputation: 15
30 / Male / Flag
Joined: Jul 2007
RE: HELP - "foreach" command!
You mean something like:

JScript code:
for(var i = 0; i < MyArray.length; i++) {
    <code_goes_here>
}

I may recommend using a different solution than using 2 arrays and hoping they will remain synchronised:

JScript code:
/* CLASS Item([string] ID: the ID you stored in the Test array,
[string] Desc: the description you stored in the TestDesc array);*/
var Item = function(ID,Desc) {
    return {
        "ID":    ID,
        "Desc":    Desc
}

// Array of Item instances.
var MyArray = [
    new Item(
        "test 1",
        "This is test 1"),
    new Item(
        "test 2",
        "This is test 2"),
    new Item(
        "test N",
        "This is test N")
]

// Assume window is loaded and is assigned to WndTest;
for(var i = 0; i < MyArray.length; i++) {
    with(WndTest) {
        LstView_AddItem("ListViewID",MyArray[i].ID);
        LstView_SetItemText("ListViewID",i,1,MyArray[i].Desc);
    }
}

Note that this is untested code.

This post was edited on 05-21-2009 at 07:38 PM by SmokingCookie.
05-21-2009 07:35 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
HELP - "foreach" command! - by whiz on 05-21-2009 at 06:36 PM
RE: HELP - "foreach" command! - by SmokingCookie on 05-21-2009 at 07:35 PM
RE: HELP - "foreach" command! - by Spunky on 05-21-2009 at 07:38 PM
RE: RE: HELP - "foreach" command! - by andrewdodd13 on 05-21-2009 at 08:01 PM
RE: HELP - "foreach" command! - by SmokingCookie on 05-21-2009 at 07:41 PM
RE: HELP - "foreach" command! - by whiz on 05-21-2009 at 08:01 PM
RE: HELP - "foreach" command! - by whiz on 05-21-2009 at 08:17 PM
RE: HELP - "foreach" command! - by SmokingCookie on 05-22-2009 at 07:11 AM
RE: HELP - "foreach" command! - by whiz on 05-22-2009 at 12:49 PM
RE: HELP - "foreach" command! - by SmokingCookie on 05-22-2009 at 12:54 PM
RE: HELP - "foreach" command! - by whiz on 05-22-2009 at 04:17 PM
RE: HELP - "foreach" command! - by SmokingCookie on 05-22-2009 at 04:20 PM
RE: HELP - "foreach" command! - by whiz on 05-22-2009 at 05:07 PM
RE: HELP - "foreach" command! - by matty on 05-22-2009 at 05:12 PM
RE: HELP - "foreach" command! - by felipEx on 05-22-2009 at 05:15 PM
RE: HELP - "foreach" command! - by whiz on 05-22-2009 at 07:06 PM


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