To access dynamically created objects - VBScript

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 12 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
krishkri
Posts: 9
Last visit: Wed May 30, 2018 7:24 pm

To access dynamically created objects - VBScript

Post by krishkri »

Hai,

I am creating N number of dictionary objects (within a for loop) dynamically in main program using VBScript. Is there any method to access theses objects randomly?
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

To access dynamically created objects - VBScript

Post by jvierra »

You could use the vbscript random function Rnd.
http://msdn.microsoft.com/en-us/library ... S.85).aspx

jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

To access dynamically created objects - VBScript

Post by jvierra »

I have no idea what you are talking about. A dictionary is a single object. You add things to it using the 'Add' method.

If you post your code we might be able to better understand what it is that you are asking.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

To access dynamically created objects - VBScript

Post by jvierra »

Most of this code make no sense.

GetObject only works with LDAP strings. It will not get you a dictionary object. Dictionary objects can only be created with "CreateObject".

The code does not appear to d anything useful.

Where did you get this script?
What is it that you are trying to accomplish?
This topic is 12 years and 10 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked