Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
I've been playing around with the Scripting Dictionary, and it can be quite usefull. However I can't get a certain command to work in Kix. To illustrate, this is how the dictionary basically works:
Code:
$objDict = CreateObject("Scripting.Dictionary")
$objDict.Add("item1","value1")
$objDict.Add("item2","value2")
$objDict.Add("item3","value3")
? "Amount of Items: " + $objDict.Count
? "Value of Item1: " + $objDict("item1")
;Enumeration of Items and Value's
For Each $objItem in $objDict
? "Item: " + $objItem " contains value: " + $objDict($objItem)
Next
Pretty simple right? Now, in VBS you can replace the values by doing:
Code:
$objDict("item2") = "value ANYTHING"
Do that in Kix, and it will error out. Since This is COM, I also tried:
Code:
$objDict("item2").Value = "value ANYTHING"
But that just doesn't change the value, I'm basically at a loss here, hoping anyone here has some insights.
Got interested... re.add doesn't work. I saw what you meant about .remove and .add changing the sort order. By the way... a few mods to make your code work right...
Code:
$objDict = CreateObject("Scripting.Dictionary")
$objDict.Add("item1","value1")
$objDict.Add("item2","value2")
$objDict.Add("item3","value3")
? "Amount of Items: " + $objDict.Count
? "Value of Item1: " + $objDict.item("item1")
;Enumeration of Items and Value's
For Each $objItem in $objDict
? "Item: " + $objItem " contains value: " + $objDict.item($objItem)
Next
Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
Your mods are weird that they work, the way I do it is the way it was intended PowerShell uses HashTables, which is a total different approach, although I used to LOVE HashTables in MSL