[Webinar] Streamline your web hosting managementRegister Today


vbscript: is it posible, have a check box on a web page and if not checked in a certian time it continues and write line to a file

Posted on 2004-07-31
Medium Priority
Last Modified: 2012-06-21
im looking to make a page with a check box and then after lets say 30 seconds it checks for default checked checkboxes/and checked checkboxes and continues writing what boxes where checked toa text file

is this posible?

if it is whats the code for it as i have no clue where to start.

thanks alot for any help and will award more points if you want as i think this is a very hard question as i cant do it at all.

thanks again
Question by:Johnny
  • 3
  • 2
LVL 17

Accepted Solution

zzzzzooc earned 2000 total points
ID: 11686104
>>i have no clue where to start.
It wouldn't be a problem if I didn't have to write VBScript in notepad but since I do, here's just a snippet to get you started...

<script language="VBScript">
    sub Test()
        Dim objCol, objItem
        Set objCol = Document.All.tags("input")
        For Each objItem In objCol
            If objItem.Type = "checkbox" Then
                If objItem.Checked = True Then
                    MsgBox objItem.Name & " is checked."
                    MsgBox objItem.Name & " is unchecked."
                End If
            End If
    end sub
<input name="Check1" type="CheckBox">My Check1<br>
<input name="Check2" type="CheckBox">My Check2<br>
<input name="Check3" type="CheckBox">My Check3<br>
<input type="Button" value="Testing" onClick="Test()">

Author Comment

ID: 11687814
using the above example heres what i want to do

<input name="Check1" type="CheckBox">My Check1<br>
<input name="Check2" type="CheckBox">My Check2<br>
<input name="Check3" type="CheckBox">My Check3<br>

would need to have the info read in from a file like checkbox.ini/checkbox.txt or something so that the fields check1 and my check1 can be grabed from the file.

next it would have a default(checked state) when grabed from that same checkbox.ini/checkbox.txt so they will show up prechecked when it loads or a button is pressed.

next it would then write to another text file lets say results_checkbox.txt what checkboxes where in fact check marked.

i wish i could do this in java i think that would be alot easer but heres my problem if anyone else has a sugestion im very open to making this happin...

im looking to be able to install a few programs with a clean install of xp and i want to be able to pick the programs installed.well java in not installed as a default anymore and to get it to install does not always take till next reboot or at all if theres a problem. so NO java(no JOY). im not sure if vb will work too as doesnt some of the files have to be present for that to work too.
im looking for checkboxes to be able to select what programs to install(id like it to be in html format, but not relaly nessary as long as its checkboxes.)

any farther help would be great and yes i will award more points as this is involved and odd.
Thanks again
LVL 17

Expert Comment

ID: 11689231
>>and yes i will award more points as this is involved and odd
You can't offer more than 500pts for a single question. You may find it best to open additional questions and ask portions of what you're trying to do within them. They'll be answered quickly if they don't require so much time (for the Expert) to answer.

For now, I'll direct you to sites that'll cover some areas..

>>would need to have the info read in from a file
>>next it would then write to another text file
You can CreateObject() the FSO and use that. Even though the below mentions ASP, it can of course be used for VBScript.

"How To Manipulate Text Files in an ASP Page"

>>next it would have a default(checked state)
My previous example detailed how to get the checked state. To set it, it's similar. (objItem.Checked = True/False)

Author Comment

ID: 11690379
ok im pretty close to everything but i keep getting an error for the CreateObject() the FSO something about active x cant open CreateObject() the FSO thingy...

i also need the timmer to fire off the submit button but as you said ill ask that in another question

ill award you the points as you did answer and point me inthe right direction as i couldnt find out how to start with this...

thanks again
LVL 17

Expert Comment

ID: 11690564
It may depend on your browser's security permissions whether it can create the object or not. Here's an example that MsgBox's the # of drives your system has.

Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
msgbox "You have " & objFSO.drives.count  & " drives."

Good luck though. :)

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question