moveFirst Method

Resets the current item in an Enumerator object to the first item.

function moveFirst()

Remarks

If there are no items in the collection, the current item is set to undefined.

Example

In following example, the moveFirst method is used to evaluate members of the Drives collection from the beginning of the list:

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);
}

Requirements

Version 3

Applies To:

Enumerator Object

See Also

Reference

atEnd Method

item Method (Visual Studio - JScript)

moveNext Method

Change History

Date

History

Reason

March 2009

Modified example.

Content bug fix.