Hey, Scripting Guys.
Help me, please, solve my problem.
I have a vbs script with gui (HTA). I'm using multi select listbox. But have an error Error "Object not a collection". It seems that script can't determinate it like variable, only sees the string.
Let me show you.
<script language="VBScript">
Sub RunScript
` There is three arrays of PC's that i determine in begining
arrRegion1 = Array(_
"Region1PC1", _
"Region1PC2", _
"Region1PC3", _
......................
)
arrRegion2 = Array(_
"Region2PC1", _
"Region2PC2", _
"Region2PC3", _
......................
)
arrRegion3 = Array(_
"Region3PC1", _
"Region3PC2", _
"Region3PC3", _
......................
)
For i = 0 to (MultiListbox.Options.Length - 1)
If (MultiListbox.Options(i).Selected) Then
For Each strComputer In MultiListbox.Options(i).Value
`Do something, but i can't do anything decause error appears. It says"The Object not a collection"
next
End If
next
End Sub
</script>
<body>
<select size="3" name="MultiListbox" multiple>
<option value=arrRegion1>Region1</option>
<option value=arrRegion2>Region2</option>
<option value=arrRegion3>Region3</option>
</select>
<input id=runbutton class="button" type="button" value="Run Button" name="run_button" onClick="RunScript">
</body>
I think MultiListbox.Options(i).Value script sees as string "Region1", but not as array Region1 as collection of PC's.
How can I tell the script to use Region1 as array of PC's when option 1 selected and etc.
Thanks for help.