Share via


moveNext Method (JScript 5.6) 

Moves the current item to the next item in the collection.


enumObj.moveNext( ) 

Remarks

The required enumObj reference is any Enumerator object.

If the enumerator is at the end of the collection or the collection is empty, the current item is set to undefined.

Example

In following example, the moveNext method is used to move to the next drive in the Drives collection:

function ShowDriveList(){

   var fso, s, n, e, x;                 //Declare variables.

   fso = new ActiveXObject("Scripting.FileSystemObject");

   e = new Enumerator(fso.Drives);      //Create Enumerator object.

   s = "";                              //Initialize s.

   for (; !e.atEnd(); e.moveNext())

   {

      x = e.item();

      s = s + x.DriveLetter;            //Add drive letter

      s += " - ";                       //Add "-" character.

      if (x.DriveType == 3)

         n = x.ShareName;               //Add share name.

      else if (x.IsReady)

         n = x.VolumeName;              //Add volume name.

      else

         n = "[Drive not ready]";       //Indicate drive not ready.

      s +=   n + "\n";

   }

   return(s);                           //Return drive status.

}

Requirements

Version 3

Applies To: Enumerator Object (JScript 5.6)

See Also

Reference

atEnd Method (JScript 5.6)
item Method (JScript 5.6)
moveFirst Method (JScript 5.6)