VBScript-- select from multiple arrays

I would like to begin a vbscript with a simple input box that allows me to enter a keyword, which in turn calls a specific array contained within the script. The script would then run against that array.

To clarify, my network consists of multiple subnets. My vbscript includes an array for each individual subnet ( IP scope ). When I execute the script, I want it to ask me which subnet (array) I wish to run the script against or if I want to run the script against all subnets (all of the arrays).
SnAkEhIpSAsked:
Who is Participating?
 
BullmanTechCommented:
See the attachment. Prompt user with Yes/No for 'Use All Subnets'. If No, display an InputBox for entering which subnet. Subnet, or "ALL" is stored in a string which can be used by an IF or SELECT CASE statement.
ChooseSubnet.vbs
0
 
Bill PrewCommented:
A couple of the more obvious ways to do this would be a 2 dimensional array, or using a dictionary.

In the first case you just add another dimension to you array and size it for as many subnets as you have.  You would need another array though of the subnet "names" so that you know the dimension value for the new 2 dimension array.

I'd prefer the dictionary approach though, which is basically a key / value pair structure.  You can place one entry in the dictionary for each subnet, with the name of the subnet as the "key", and then the data could be the existing array that you are using.

If you can provide the code you have now I can adjust for the dictionary approach, once you see it I think you will find it very easy to work with.

~bp
0
 
SnAkEhIpSAuthor Commented:
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
SnAkEhIpSAuthor Commented:
Thanks Bill!
0
 
Bill PrewCommented:
So you are all set with this I gather, you thanked "Bill" but it wasn't my response above, so wanted to make sure I didn't miss something.

~bp
0
 
SnAkEhIpSAuthor Commented:
My apologies! I thought I was responding to you. The suggested code worked, but I'm interested to know if using your dictionary approach would not be a better alternative. I've posted another related question for which I have not awarded any points. Would you be interested in taking a look? It involves the same code that I posted here. Perhaps you could incorporate your current idea into the solution.
0
 
Bill PrewCommented:
Okay, let me take a look...

~bp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.