Solved

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
5
451 Views
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
Pern
0
Comment
Question by:Johnny
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 17

Accepted Solution

by:
zzzzzooc earned 500 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...

<html>
<head>
<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."
                Else
                    MsgBox objItem.Name & " is unchecked."
                End If
            End If
        Next
    end sub
</script>
</head>
<body>
<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()">
</form>
</body>
</html>
0
 

Author Comment

by:Johnny
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
0
 
LVL 17

Expert Comment

by:zzzzzooc
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"
http://support.microsoft.com/default.aspx?scid=kb;en-us;300982

>>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)
0
 

Author Comment

by:Johnny
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
0
 
LVL 17

Expert Comment

by:zzzzzooc
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.

<SCRIPT LANGUAGE="VBScript">
Dim objFSO
Set objFSO = CreateObject("Scripting.FileSystemObject")
msgbox "You have " & objFSO.drives.count  & " drives."
</SCRIPT>

Good luck though. :)
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…

729 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