Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Check Box Input

Status
Not open for further replies.

cwsstins

MIS
Aug 10, 2004
412
US
Is it possible to use VBS to invoke a check box type menu? I've got a script that uses a inputbox to allow the user to enter a value. But what I would prefer is a window that pops up with three options, each with a check box, so that the selections can be used in another function.

Thanks,
stinsman
 
SW, I'll check them out...just from a glance, I see that the .ocx files must be downloaded to the client. Would that be necessary on all systems that run the vbs program, or just for the development of the program?

stinsman
 
stinsman,

That would be on all the systems that use the script. But, I've written a module for us here that I use in all my vbs scripts that check for these file and then install them if needed... I have this saved as a seperate .vbs script and I have a single line that calls this script in ALL .vbs scripts that need these functionalities.

-SWarrior
 
Hello stinsman!

I haven't had time to look into SWarrior's ocx solution, but if you know HTML, you can easily create a popup box that mimics the functions of a standard popup box. This is a very basic example of how to do something similar:
Code:
Dim strHTML
Dim IE


strHTML = "<HTML>" & "<HEAD>"
strHTML = strHTML & vbCrlf & "<TITLE>Help Box</TITLE>"
strHTML = strHTML & vbCrlf & "<SCRIPT TYPE=""text/vbscript"">"
strHTML = strHTML & vbCrlf & "Sub subOK()"
strHTML = strHTML & vbCrlf & "	Msgbox ""test"""
strHTML = strHTML & vbCrlf & "End Sub"
strHTML = strHTML & vbCrlf & "</SCRIPT>"
strHTML = strHTML & vbCrlf & "</HEAD>"
strHTML = strHTML & vbCrlf & "<BODY>"
strHTML = strHTML & vbCrlf & "Error occured. If you want"
strHTML = strHTML & vbCrlf & "<BR> help, click the link below."
strHTML = strHTML & vbCrlf & "<BR><A HREF=""[URL unfurl="true"]http://www.help.com"">http://www.help.com</A>"[/URL]
strHTML = strHTML & vbCrlf & "<BR><CENTER><INPUT TYPE=""button"" name=""cmdOK"" Value=""OK"" onClick=""subOK""></CENTER>"
strHTML = strHTML & vbCrlf & "</BODY></HTML>"

MsgBox strHTML
Set IE = WScript.CreateObject("InternetExplorer.Application")
IE.Navigate "about:blank" 
IE.AddressBar = 0
IE.menubar = 0
IE.ToolBar = 0
IE.StatusBar = 0
IE.width = 400
IE.height = 150
IE.resizable = 0
IE.visible = True

ie.Document.Body.InnerHTML = strHTML

MsgBox "Test"

Good luck!
 
You may also consider an hta file.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for the responses guys...

SW, I've tried using that program, but it keeps crashing on me...

Snotmare, I couldn't get that code to display check boxes, only input boxes.

PHV, what is an .hta file?
 
stinsman,

The example I provided was to show you that you could use HTML to custom create your own input boxes. You'll have to modify the HTML code to use input boxes rather than check boxes.

Good luck!
 
stinsman,

Crashing, or not working right ?? Depending on what you're trying to do, those samples sometimes work, and sometimes don't. I've used the .OCX forms quite a bit, and can help you with whatever you need helping on. Post the section of code you need help with, and I'll show you how to adjust it to work for your needs. Basically, the hardest thing to do is to get the forms to appear and work properly. Other than that, it's gravy !!

-SWarrior
 
No, it's actually crashing on me. I get a message box indicating that "MS Windows Based Script Host has encournted a problem and needs to close. We are sorry...yadda yadda."

stinsman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top