views:

86

answers:

1

Hi, I'm trying to figure out how to write a vbscript that does this: I've got a system of checkboxes which represents a type of software.

And each of these checkboxes are collected into each own boolean variable. For each of these 'true's I want to send an e-mail.

How can I do this using a "for each" loop or something?

+2  A: 

Which user interface are you using? HTML (i.e. <input type=checkbox>)? Then instead of collecting each checkbox into its own boolean, directly access the checkbox controls:

Dim myCheckboxes
myCheckboxes = Array(checkbox1, checkbox2, ...)

Dim c
For Each c In myCheckboxes
    If c.checked Then 
       Call MySendMailMethod("Checkbox " & c.name & " has been checked!")
    End If
Next
Heinzi
Oh, I'm using a weird system called Quest ActiveRolesServer where I have no control whatsoever over the web interface. All I can do is collect values using Request.Get("checkbox1")And since I need to use these values more than once in a script, the easiest way is to assign these values to their own variables and then use the variable when I need it.But using your example here, I can do a "myArray = Array(bool1, bool2) and then do a "For Each myArray = True" ? or?
Kenny Bones
Nevermind. I think I solved it using your example as a good starting point :) I just thought a bit to difficult I guess :)
Kenny Bones