This documentation is archived and is not being maintained.

atEnd Method

Updated: July 2009

Returns a Boolean value indicating if the enumerator is at the end of the collection.

function atEnd() : Boolean

The atEnd method returns true if the current item is the last one in the collection, the collection is empty, or the current item is undefined. Otherwise, it returns false.

In following code, the atEnd method is used to determine if the end of a list of drives has been reached:

function ShowDrives()
{
    var s = "";

    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var e = new Enumerator(fso.Drives);

    e.moveFirst();
    while (e.atEnd() == false)
    {
        var x = e.item();

        s += x.DriveLetter;
        s += " - ";

        if (x.DriveType == 3)
            s += x.ShareName;
        else if (x.IsReady)
            s += x.VolumeName;
        else
            s += "[Drive not ready]";

        s += "\n";

        e.moveNext();
    }
    return(s);
}

Date

History

Reason

July 2009

Modified example.

Information enhancement.

Show: