VBScript - Dictionary Objects(maps) mapping to Arrays (vb Arrays)
Posted on 2009-04-12
I have a script that I have, and it works...but I have eight other groups that do the exact same thing but they need a different Root path to run it from. If I had a way
1. Prompt the user what bussiness group they belonged to.
2. That respone information and the variable strParentFolder each time it is run. If I could do that I would be able to service all Nine groups with just this one same script.
- everyone shares this root path: CONST ROOT_STORAGE_Path = \\deptsvr\raining.
-there are 9 folders that are built: (0) = CONST ROOT_STORAGE_Path
(1) = CONST ROOT_STORAGE_Path & "_Sales"
(2) = CONST ROOT_STORAGE_Path & "_Processing"
(3) = CONST ROOT_STORAGE_Path & "_Service"
(4) = CONST ROOT_STORAGE_Path & "_Commercial"
(5) = CONST ROOT_STORAGE_Path & "_Claims"
(6) = CONST ROOT_STORAGE_Path & "_Tech"
(7) = CONST ROOT_STORAGE_Path & "_Spec"
(8) = CONST ROOT_STORAGE_Path & "_Accouting"
- I need to get a map to of: Location => Array of Dept folders
-I need a map of locations and then somehow map that to a list of items (dept folders).
-From what reasearch I can find it seems that that I need to do this with dictionary objects(Maps) mapping to Arrays (vb Arrays). I see two things suggested
a. map an array to one item in a map(dictionary object),
b. have a map of locations mapping to a map of depts folders.
I kind of get the concept but I don't understand where to start. Reasearching the answers on this site I found something that can get me started with setting up the array, but I know how to tie it all together for what I am trying to do:
' Declare the Array and ReDim it to give it a size
' Iterate thru each "slot" in the Array and place a Dictionary in it
For i = 0 To UBound(oDictionaryArray)
Set oDictionaryArray(i) = CreateObject("Scripting.Dictionary")
' Put something different into each Dictionary in the Array
oDictionaryArray(i).Add "Name", "Dictonary" & i
' Show a value from one of the Arrays
Index = 2
WScript.Echo oDictionaryArray(Index).Item("Name") ' Should be "Dictionary2"
Can someone help me?