In this article we are about to see the efficiency of a dictionary when checking or retrieving values from a web-table, For this purpose we have the following table in our AUT. This is the script that will parse the table and will upload the dictionary. After running the script above, the solarExch dictionary loaded [...]
Posts in category Dictionary
Complex Dictionary Usage
Add Elements to a Dictionary
Demonstration script that adds three key-item pairs to a Script Runtime Dictionary. Script must be run on the local computer. Set oDictionary = CreateObject(“Scripting.Dictionary”) oDictionary.Add “Printer 1″, “Printing” oDictionary.Add “Printer 2″, “Offline” oDictionary.Add “Printer 3″, “Printing”
Delete All Elements from a Dictionary
Demonstration script that deletes all the key-item pairs from a Script Runtime Dictionary. Script must be run on the local computer Set oDictionary = CreateObject(“Scripting.Dictionary”) oDictionary.Add “Printer 1″, “Printing” oDictionary.Add “Printer 2″, “Offline” oDictionary.Add “Printer 3″, “Printing” keysCol = oDictionary.Keys Print “First run: ” For Each KeyStr in keysCol Print KeyStr Next oDictionary.RemoveAll keysCol = [...]
Delete One Element from a Dictionary
Demonstration script that deletes a specific key-item pair from a Script Runtime Dictionary. Script must be run on the local computer. Set oDictionary = CreateObject(“Scripting.Dictionary”) oDictionary.Add “Printer 1″, “Printing” oDictionary.Add “Printer 2″, “Offline” oDictionary.Add “Printer 3″, “Printing” keysCol = oDictionary.Keys Print “First run: ” For Each keyStr in keysCol Print keyStr Next oDictionary.Remove(“Printer 2″) keysCol= [...]
List the Number of Items in a Dictionary
Demonstration script that counts the number of key-item pairs in a Script Runtime Dictionary. Script must be run on the local computer. Set oDictionary = CreateObject(“Scripting.Dictionary”) oDictionary.Add “Printer 1″, “Printing” oDictionary.Add “Printer 2″, “Offline” oDictionary.Add “Printer 3″, “Printing” Print objDictionary.Count
Verify the Existence of a Dictionary Key
Demonstration script that verifies the existence of a particular key within a Script Runtime Dictionary. Script must be run on the local computer. Set oDictionary = CreateObject(“Scripting.Dictionary”) oDictionary.Add “Printer 1″, “Printing” oDictionary.Add “Printer 2″, “Offline” oDictionary.Add “Printer 3″, “Printing” If oDictionary.Exists(“Printer 4″) Then Print “Printer 4 is in the Dictionary.” Else Print “Printer 4 is [...]




Recent Comments