Radio buttons in VBScript

I know this is an often asked question, but I can't seem to find an answer that fits my simple needs.
I'm wrtiing a VBscript which requires to get user input from a list of choices. It seems the proper way is to use an external HTA file.
But I don't know how this should look like.

So if anyone could give me a basic example of a VBScript obtaining user answers from an HTA file, it would help a lot.

Thanks
fhmsolutionsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

TakedaTCommented:
Check out this link.  It is as basic as it can get and should help you out.

http://technet.microsoft.com/en-us/library/ee692602.aspx
0
fhmsolutionsAuthor Commented:
Thanks, but this shows an HTA that includes VBscript. I need the opposite.
In sequence : The VBS launches the HTA
The HTA shows the buttons, then gets the answer from the user
The VBS gets the information back and goes on
0
TakedaTCommented:
Thats an interesting idea, but Im not sure how to approach it.  I dont think it is possible with an .hta, but it may be possible using the InternetExplorer.Application object.  I will play and see what I can do.
0
Introduction to R

R is considered the predominant language for data scientist and statisticians. Learn how to use R for your own data science projects.

fhmsolutionsAuthor Commented:
Thanks. I know it's been done before.
I found some information about it here : http://stackoverflow.com/questions/923503/how-to-create-options-dialog-with-vbscript
But I'm not good enough with both VBScript and HTA to adapt this to my needs.

0
TakedaTCommented:
I played a bit.  Here is what I came up with.  It shouldnt be difficult to customize it to your needs.  I hope this is what you were looking for.
strRadio = GetRadioAnswer( "Please check an option" )
WScript.Echo strRadio

Function GetRadioAnswer( myPrompt )
    Dim objIE
    Set objIE = CreateObject( "InternetExplorer.Application" )
    objIE.Navigate "about:blank"
    objIE.Document.Title = "Get Radio Option"
    objIE.ToolBar        = False
    objIE.Resizable      = False
    objIE.StatusBar      = False
    objIE.Width          = 320
    objIE.Height         = 180
    With objIE.Document.ParentWindow.Screen
        objIE.Left = (.AvailWidth  - objIE.Width ) \ 2
        objIE.Top  = (.Availheight - objIE.Height) \ 2
    End With
    Do While objIE.Busy
        WScript.Sleep 200
    Loop
	objIE.Document.Body.InnerHTML = "<DIV align=""center"">"&myPrompt&"<P><input type='radio' name='RadioOption' value='1'>1<BR>"&_
		"<input type='radio' name='RadioOption' value='2'>2<BR>"&_
		"<input type='radio' name='RadioOption' value='3'>3<br>"&_
		"<input id='OK' type='hidden' value='0' name='OK'>"&_
		"<input type='submit' value='OK' onClick='VBScript:OK.Value=1'>"
    objIE.Visible = True
    Do While objIE.Document.All.OK.Value = 0
        WScript.Sleep 200
    Loop
    If objIE.Document.All.RadioOption(0).checked=true then GetRadioAnswer="first is checked"
    If objIE.Document.All.RadioOption(1).checked=true then GetRadioAnswer="second is checked"
    If objIE.Document.All.RadioOption(2).checked=true then GetRadioAnswer="third is checked"
    objIE.Quit
    Set objIE = Nothing
End Function

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
fhmsolutionsAuthor Commented:
Thanks a lot. That was exactly what I needed. I adapted it to my needs and it works perfectly.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.