VBS is this possible?

Hewlett-packard / Sd2100
March 9, 2010 at 23:21:11
Specs: Windows 7, 1024
is it possible to have lets say 3 checkboxs

and you have a button

how can would you go about creating separate tasks for each box check while having one sub routine? is that possible?

does anyone have any example code i could look at? i googled but nothing.

See More: VBS is this possible?

Report •

March 10, 2010 at 05:26:25
You can, yes. I'd suggest you break it up into one function for each check box/radio button + one central dispatcher function called by the button press, though.

Report •

March 10, 2010 at 16:54:25

You wouldn't happen to have an example i could look at? i learn better if i see an example.

Thank you for your support!

Report •

March 11, 2010 at 01:12:32
any idea guys?

thank you !!!

Report •

Related Solutions

March 11, 2010 at 15:59:20
Here is what i had from experimenting with your code.
I'm not sure exactly how you intended for the form to be laid out (ie: radio buttons, check boxes, or select-list).
So look at this, try it, then advise what changes/what needs to be done, where and when. The interpretation i put on it is probably not what you wanted.

<body bgcolor="white">
Maintenance Menu!

<SCRIPT Language="VBScript">
Sub Window_Onload
Set fso = createobject("Scripting.FileSystemObject")
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set oFile = fso.OpenTextFile ("c:\htm\texto", Forappending, True)
ofile.writeline(date() time())
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
intHorizontal = objItem.ScreenWidth
intVertical = objItem.ScreenHeight
intLeft = (intHorizontal - 300) / 2
intTop = (intVertical - 400) / 2
window.resizeTo 400,300
window.moveTo intLeft, intTop
End Sub
<SCRIPT Language="VBScript">
public ss

Sub TestSub
For Each objButton in RadioOption
If objButton.Checked Then
msgbox "ss is:"&ss
End If
End Sub
sub test1
Msgbox "test1: * You selected " & objButton.Value & "."
end sub
sub test2
Msgbox "test2: ** You selected " & objButton.Value & "."
end sub
sub test3
Msgbox "test3: *** You selected " & objButton.Value & "."
end sub
sub test4
Msgbox "test4: **** You selected " & objButton.Value & "."
end sub

Sub TestSub2
If OptionChooser.Value <> 0 Then
Msgbox "-- You selected Option " & OptionChooser.Value & "."
select case ss
case 1
case 2
case 3
case 4
case else
msgbox "???"
end select
End If
End Sub

sub test21
Msgbox "test21: * You selected " & ss & "."
end sub
sub test22
Msgbox "test22: ** You selected " & ss & "."
end sub
sub test23
Msgbox "test23: *** You selected " & ss & "."
end sub
sub test24
Msgbox "test24: **** You selected " & ss & "."
end sub

sub disable
if radiooption(0).checked then
end if
for each objbutton in radiooptionA
end sub

<input type="radio" name="RadioOption" onclick="disable" value="0">Simple!

<input type="radio" name="RadioOption" onclick="disable" value="1">Advanced!

<input type="radio" name="RadioOption" onclick="TestSub" value="2">Maintenance!

<input type="radio" name="RadioOptionA" onclick="TestSub" value="3">Utilites!

<input type="radio" name="RadioOptionA" onclick="TestSub" value="4">CMD-Commands!

<input type="radio" name="RadioOption" value="5">Exit!

<input id=runbutton class="button" type="button" value="Change Menu" name="run_button" onClick="TestSub">

<!---select size="1" name="OptionChooser" onChange="TestSub2"-->
<select size="1" name="OptionChooser">
<option value="0"></option>
<option value="1">Delete Temporary files!</option>
<option value="2">Defragment files!</option>
<option value="3">Check a HDD for errors!</option>
<option value="4">Network Repair!</option>
<option value="5">Run all Tasks!</option>
<input id=runbutton class="button" type="button" value="Run Chosen Task" name="run_button" onClick="TestSub2">

Report •

Ask Question