moveFirst 메서드
Enumerator 개체의 현재 항목을 첫 번째 항목으로 재설정합니다.
function moveFirst()
설명
컬렉션에 항목이 없으면 현재 항목이 undefined로 설정됩니다.
예제
다음 예제에서는 moveFirst 메서드를 사용하여 목록 시작 부분부터 Drives 컬렉션의 멤버를 확인합니다.
function ShowDrives()
{
var s = "";
var bytesPerGB = 1024 * 1024 * 1024;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var e = new Enumerator(fso.Drives);
e.moveFirst();
while (e.atEnd() == false)
{
var drv = e.item();
s += drv.Path + " - ";
if (drv.IsReady)
{
var freeGB = drv.FreeSpace / bytesPerGB;
var totalGB = drv.TotalSize / bytesPerGB;
s += freeGB.toFixed(3) + " GB free of ";
s += totalGB.toFixed(3) + " GB";
}
else
{
s += "Not Ready";
}
s += "\n";
e.moveNext();
}
return(s);
}