Help > Indexing > Indexing via Scripting > Scripting Reference > Utility Classes

Utility Classes

These classes are available to your script, including:


Dictionary Object

Object that stores data key, item pairs.

Properties/Methods

Count
Returns the number of items in the dictionary

Item(NameOrIndex)
Returns the value at the given index or name.

Keys(Index)
Returns the key at the given index.

Example
Set Dict = Server.CreateObject("Scripting.Dictionary")
Dict("Apple") = 10
Dict("Orange") = 20
Dict("Pear") = 5

For I = 0 to Dict.Count-1
	Key = Dict.Keys(I)
	Val = Dict(I)
Next

List Object

The List object is a simple collection of items that can be added to or removed from easily.

Properties/Methods

Add(Item)
Adds the given item to the end of the list.

Clear
Remove all items from the list.

Count
Returns the number of items in the dictionary

Delete
Delete the item at the given location from the list.

Insert(Index, Item)
Insert the given item at the specified location.

Example
Set List = Server.CreateObject("Scripting.List")
List.Add "Apple"
List.Add "Orange"
List.Add "Pear"
List.Add 10

For Each Item in List
	' Add your logic here...
Next

Queue Object

The Queue object contains a first-in-first-out list of elements.

Properties/Methods

Clear
Remove all items from the queue.

Count
Returns the number of items from the queue.

Peek
Returns the next item to be popped from the queue without removing it.

Pop
Pop the next item from the queue and return it.

Push(Item)
Adds new elements to the queue.

Example
Set Queue= Server.CreateObject("Scripting.Queue")

Queue.Push "Item 1"
Queue.Push Array("Item 2", "Item 3", "Item 4")  

Do While Queue.Count > 0 
	Item = Queue.Pop
	' Add your logic here
Loop

Stack Object

The Stack object contains a first-in-last-out list of elements.

Properties/Methods

Clear
Remove all items from the stack.

Count
Returns the number of items from the stack.

Peek
Returns the next item to be popped from the stack without removing it.

Pop
Pop the next item from the stack and return it.

Push(Item)
Adds new elements to the stack.

Example
Set Stack = Server.CreateObject("Scripting.Stack")

Stack.Push "Item 1"
Stack.Push Array("Item 2", "Item 3", "Item 4")  

Do While Stack.Count > 0 
	Item = Stack.Pop
	' Add your logic here
Loop