HTA Submit Application

I have an hta that I built that works great however I want to change the button type to radio, and make it so that only one can be selected, as soon as I do what is needed for that I get script errors. I will past the codes for the working, and none working versions below.
Working Code:
<html>
<head>
<title>Help Desk Interface</title>
<HTA:APPLICATION 
     ID="objTest" 
     APPLICATIONNAME="HTATest"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
>
</head>
<body STYLE="font:14 pt arial; color:white;
 filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0, StartColorStr='#000000', EndColorStr='#3399ff')">
 
 
<style type="text/css">
.myclass {color:charcoal; font-family:arial; font-size:70%}
.myheader {color:charcoal; font-family:arial;font-weight:bold; font-size:100%}
</style>
<SCRIPT LANGUAGE="VBScript">
 
Sub Window_OnLoad
	intHeight = 380
	intWidth = 600
	Me.ResizeTo intWidth, intHeight
	Me.MoveTo (screen.width / 2) - (intWidth / 2), (screen.height / 2) - (intHeight / 2)
	Set objNetwork = CreateObject("WScript.Network")
	Set WshShell = CreateObject("WScript.Shell")
End Sub
 
    Sub TestSub
	Set WshShell = CreateObject("WScript.Shell")    
        If Checkbox1.Checked Then
            WshShell.Run "c:\windows\system32\cmd.exe /c \\141arw-ap-01\app-installs\automation\launchcheckdrahd.bat"
        End If
        If Checkbox2.Checked Then
            WshShell.Run "c:\windows\system32\cmd.exe /c \\141arw-ap-01\app-installs\automation\launchcheckremedyhd.bat"
        End If
        If Checkbox3.Checked Then
            WshShell.Run "c:\windows\system32\cmd.exe /c \\141arw-ap-01\app-installs\automation\OUTLOOKHD.bat"        
        End If
        If Checkbox4.Checked Then
            WshShell.Run "http://141arwsharepoint/sites/help/Help%20Desk%20Training/Forms/AllItems.aspx"       
        End If
	window.Close   
    End Sub  
 
</SCRIPT>
 
<body>
 
    <br>
 
    <input type="checkbox" name="Checkbox1"> Launch DRA<br>
    <input type="checkbox" name="Checkbox2"> Launch Remedy<br>
    <input type="checkbox" name="Checkbox3"> Launch Outlook<br>
    <input type="checkbox" name="Checkbox4"> Launch Help Desk Tasks Outline<p>
    <input id=runbutton  class="button" type="button" value="Run" name="run_button" onClick="TestSub">
 
</body>
 
Non-Working Code:
<html>
<head>
<title>Help Desk Interface</title>
<HTA:APPLICATION 
     ID="objTest" 
     APPLICATIONNAME="HTATest"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
>
</head>
<body STYLE="font:14 pt arial; color:white;
 filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0, StartColorStr='#000000', EndColorStr='#3399ff')">
 
 
<style type="text/css">
.myclass {color:charcoal; font-family:arial; font-size:70%}
.myheader {color:charcoal; font-family:arial;font-weight:bold; font-size:100%}
</style>
<SCRIPT LANGUAGE="VBScript">
 
Sub Window_OnLoad
	intHeight = 380
	intWidth = 600
	Me.ResizeTo intWidth, intHeight
	Me.MoveTo (screen.width / 2) - (intWidth / 2), (screen.height / 2) - (intHeight / 2)
	Set objNetwork = CreateObject("WScript.Network")
	Set WshShell = CreateObject("WScript.Shell")
End Sub
 
    Sub TestSub
	Set WshShell = CreateObject("WScript.Shell")    
        If Check1.Checked Then
            WshShell.Run "c:\windows\system32\cmd.exe /c \\141arw-ap-01\app-installs\automation\launchcheckdrahd.bat"
        End If
        If Check2.Checked Then
            WshShell.Run "c:\windows\system32\cmd.exe /c \\141arw-ap-01\app-installs\automation\launchcheckremedyhd.bat"
        End If
	window.Close   
    End Sub  
 
</SCRIPT>
 
<body>
 
    <br>
 
    <input type="radio" name="Check1" value="Check1"> Launch DRA<br>
    <input type="radio" name="Check1" value="Check2"> Launch Remedy<br>
    <br>
    <input id=runbutton  class="button" type="button" value="Run" name="run_button" onClick="TestSub">
 
</body>

Open in new window

LVL 1
141ANGAsked:
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.

Michel PlungjanIT ExpertCommented:
You have two radios. You gave them different VALUES and you test the values instead of their names.

I do not normally do VB script, but the radio is now a collection and you need to check it possibly like this:
    Sub TestSub
        Set WshShell = CreateObject("WScript.Shell")    
        If Check1(0).Checked Then
            WshShell.Run "c:\windows\system32\cmd.exe /c \\141arw-ap-01\app-installs\automation\launchcheckdrahd.bat"
        End If
        If Check1(1).Checked Then
            WshShell.Run "c:\windows\system32\cmd.exe /c \\141arw-ap-01\app-installs\automation\launchcheckremedyhd.bat"
        End If
        window.Close  
    End Sub  


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
Michel PlungjanIT ExpertCommented:
But why click twice???

And why create a shell twice?

<html>
<head>
<title>Help Desk Interface</title>
<HTA:APPLICATION 
     ID="objTest" 
     APPLICATIONNAME="HTATest"
     SCROLL="yes"
     SINGLEINSTANCE="yes"
>
</head>
<body STYLE="font:14 pt arial; color:white;
 filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=0, StartColorStr='#000000', EndColorStr='#3399ff')">
 
 
<style type="text/css">
.myclass {color:charcoal; font-family:arial; font-size:70%}
.myheader {color:charcoal; font-family:arial;font-weight:bold; font-size:100%}
</style>
<SCRIPT LANGUAGE="VBScript">
 
Sub Window_OnLoad
        intHeight = 380
        intWidth = 600
        Me.ResizeTo intWidth, intHeight
        Me.MoveTo (screen.width / 2) - (intWidth / 2), (screen.height / 2) - (intHeight / 2)
        Set objNetwork = CreateObject("WScript.Network")
        Set WshShell = CreateObject("WScript.Shell")
End Sub
Sub TestSub1
  WshShell.Run "c:\windows\system32\cmd.exe /c \\141arw-ap-01\app-installs\automation\launchcheckdrahd.bat"
  window.Close   
End Sub  
Sub TestSub2
  WshShell.Run "c:\windows\system32\cmd.exe /c \\141arw-ap-01\app-installs\automation\launchcheckremedyhd.bat"
  window.Close   
End Sub  
 
</SCRIPT>
 
<body>
 
 
    <input class="button" type="button" name="run_button" onClick="TestSub1" value="Launch DRA">
    <input class="button" type="button" name="run_button" onClick="TestSub2" value="Launch Remedy">
 
</body>

Open in new window

0
141ANGAuthor Commented:
this last script looked promising but it returns an error on click

Line: 29
Char: 3
Error: Object required: 'WshShell'
Code: 0
URL: file:///K:/Automation/LoginType.hta
0
141ANGAuthor Commented:
This was exactly what I needed
0
Michel PlungjanIT ExpertCommented:
Then make WshShell global in scope
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
Visual Basic Classic

From novice to tech pro — start learning today.