Dictionary is sane: 1

Expected COM error:
The number of elements is different from the number of arguments expected.
<SASET VALUE=MyDictionary.Add>


English: three Spanish: tres

"one" is in the dictionary
"dog" is NOT in the dictionary



All Keys and Items ...
0: one ===> uno
1: two ===> dos
2: three ===> tres
3: four ===> cuatro
4: five ===> cinco

<HTML>
<HEAD>
   <TITLE>COM Test #2</TITLE>
<STYLE>
BODY{font-family:arial;font-size:10pt;}
TD{font-family:arial;}
TH{font-family:arial;}
</STYLE>
</HEAD>
<BODY>

<SAOUTPUT>

<!--- Create the Dictionary COM object --->
<SASET NAME=MyDictionary VALUE=CreateObject( "Scripting.Dictionary" )>

<!--- Try to output the COM object --->
Dictionary is sane: #MyDictionary#<BR>

<!--- TRY/CATCH block to see if we can catch COM exceptions --->
<SATRY>
   <SASET VALUE=MyDictionary.Add> 
</SATRY>
<SACATCH TYPE="COM">
   <BR>Expected COM error:<BR>
   <font color="red">#ERROR.message#<BR>
   #ERROR.DATA#</font><BR><BR>
</SACATCH>

<!--- Add some keys and items to the Dictionary --->
<SASET VALUE=MyDictionary.Add( "one","uno" )> 
<SASET VALUE=MyDictionary.Add( "two","dos" )> 
<SASET VALUE=MyDictionary.Add( "three","tres" )> 
<SASET VALUE=MyDictionary.Add( "four","cuatro" )> 
<SASET VALUE=MyDictionary.Add( "five","cinco" )> 

<SASET NAME=EnglishNumber VALUE="three">

<!--- Retreive an item based on a key --->
<SASET NAME=SpanishNumber VALUE=MyDictionary.Item( EnglishNumber )>
<B>English:</B> #EnglishNumber#  <B>Spanish:</B> #SpanishNumber#<BR><BR>

<!--- Try to use the Dictionary "Exists" method --->
<SAIF COND=MyDictionary.Exists( "one" )>
   "one" is in the dictionary
<SAELSE>
   "one" is NOT in the dictionary
</SAIF><BR>

<SAIF COND=MyDictionary.Exists( "dog" )>
   "dog" is in the dictionary
<SAELSE>
   "dog" is NOT in the dictionary
</SAIF><BR>

<BR><HR>
<BR><B>All Keys and Items ...</B><BR>

<!--- Iterate over all of the data to output keys/items 
        - notice here that the data returned is in a SteelArrow list
  --->
<SASET NAME=items VALUE=MyDictionary.Items()>
<SASET NAME=keys  VALUE=MyDictionary.Keys()>
<TT>
<SALOOP NAME=i FROM=0 TO=MyDictionary.Count()-1 >
   #i#: #keys[i]# ===> #items[i]#<BR>
</SALOOP>
</TT>

</SAOUTPUT>

</BODY>
</HTML>

<SAIMPORT FILE="viewExample.aro">
   <SAPARAM NAME="item" VALUE="comTest2.aro">
</SAIMPORT>