filesystemobject

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jim

    filesystemobject

    I have an example that iterates through the fso folders collection etc for
    the fso files collection. The problem is this:
    the example uses an enumerator to cycle through the collection items and i
    would like to use a for loop but I can't get the syntax correct.
    for (var i=1;i<=length;i ++) {
    eFile=oFldr.fil es;
    alert(eFile.ite m(1).type);
    }
    TIA


  • Evertjan.

    #2
    Re: filesystemobjec t

    jim wrote on 18 jun 2004 in comp.lang.javas cript:[color=blue]
    > I have an example that iterates through the fso folders collection etc
    > for the fso files collection. The problem is this:
    > the example uses an enumerator to cycle through the collection items
    > and i would like to use a for loop but I can't get the syntax correct.
    > for (var i=1;i<=length;i ++) {
    > eFile=oFldr.fil es;
    > alert(eFile.ite m(1).type);
    > }
    >[/color]

    perhaps the .item(1). should be .item(i). ?
    and the i<=length be i<=oFldr.lengt h ?

    =============== =============== =============== =

    M$ enumerates:

    function ShowFolderFileL ist(folderspec) {
    var fso, f, fc, s;
    fso = new ActiveXObject(" Scripting.FileS ystemObject");
    f = fso.GetFolder(f olderspec);
    fc = new Enumerator(f.fi les);

    for (; !fc.atEnd(); fc.moveNext()) {
    alert(fc.item() .name + "\n" + fc.item().type) ;
    }

    }

    not tested.

    see:
    <http://msdn.microsoft. com/library/en-us/script56/html/jsprofiles.asp>

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    Working...