Scripting Runtime Library(FileSystemObject, Dictioany)

Ä÷º¼ÇÀ̳ª Dictionary °³Ã¼ÀÇ Ç׸ñ ¼ö¸¦ ¹ÝȯÇÑ´Ù. ÀбâÀü¿ëÀÌ´Ù.

Àμö

objectName´Â Ç×»ó Àû¿ë ´ë»ó ¸ñ·Ï¿¡ ÀÖ´Â Ç׸ñ À̸§ Áß ÇϳªÀÌ´Ù.

Dictionary °³Ã¼³ª Ä÷º¼Ç(Drives, Folders, Files)ÀÌ µÉ ¼ö ÀÖ´Ù.

ÁöÁ¤µÈ ¸ñ·Ï °³Ã¼ÀÇ Ç׸ñ¼ö¸¦ ¹ÝȯÇϸç, ÀбâÀü¿ëÀÌ´Ù.


Count ¼Ó¼º ¿¹Á¦

°á°ú Ç¥½Ãâ
JScript Count ¿¹Á¦ Ŭ¸¯
<SCRIPT language=JScript>
function CountTest(key){
  var VBObj,dicObj,i,str; // º¯¼ö¸¦ ¸¸µç´Ù.
  dicObj=new ActiveXObject('Scripting.Dictionary');
  dicObj.Add('a','»ç°ú');       // Å°¿Í Ç׸ñÀ» Ãß°¡ÇÑ´Ù.
  dicObj.Add('b','¹Ù³ª³ª');
  dicObj.Add('c','ü¸®');
  VBObj=(new VBArray(dicObj.Keys()));   // Å°¸¦ °¡Á®¿Â´Ù.
  str='';
  for (i=0;i<dicObj.Count;i++){  // dictionary¸¦ ¹Ýº¹ÇÑ´Ù.
    str+=VBObj.getItem(i)+' - '+dicObj(VBObj.getItem(i))+'<BR>';
  }
  str+='dicObj.Count='+dicObj.Count+'<BR>';
  str+='dicObj.Item(key)='+dicObj.Item(key);
  return(str); // °á°ú¸¦ ¹ÝȯÇÑ´Ù.
}
</SCRIPT>

<DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="id=showjs.innerHTML=CountTest('c')">
 <SPAN class=ie>JScript</SPAN> <SPAN class=property>Count</SPAN> ¿¹Á¦ Ŭ¸¯</DIV>

VBScript·Î ¹Ýº¹

°á°ú Ç¥½Ãâ
VBScript Count ¿¹Á¦ Ŭ¸¯
<SCRIPT language=VBScript>
Function CountTestvb(key)
  Dim VBObj,dicObj,i,str  ' º¯¼ö¸¦ ¸¸µç´Ù.
  Set dicObj=CreateObject("Scripting.Dictionary")
  dicObj.Add "a","»ç°ú"  ' Å°¿Í Ç׸ñÀ» Ãß°¡ÇÑ´Ù.
  dicObj.Add "b","¹Ù³ª³ª"
  dicObj.Add "c","ü¸®"
  VBObj=dicObj.Keys ' keys¸¦ ¾òÀ½.
  For i=0 To dicObj.Count -1 ' array¸¦ ¹Ýº¹ÇÑ´Ù.
    str=str&VBObj(i)&" - "&dicObj(VBObj(i))&"<BR>" ' ¹Ýȯ ¹®ÀÚ¿­À» ¸¸µç´Ù.
  Next
  str=str&"dicObj.Count="&dicObj.Count&"<BR>"
  str=str&"dicObj.Item(key)="&dicObj.Item(key)
  CountTestvb=str
End Function
</SCRIPT>

<DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showvb.innerHTML=CountTestvb('c')">
<SPAN class=ie>VBScript</SPAN> <SPAN class=property>Count</SPAN> ¿¹Á¦ Ŭ¸¯</DIV>