VBScript in HTA error.

  • Thread starter Thread starter TIOOWY
  • Start date Start date
T

TIOOWY

Guest
Hi all,

I am working on a HTA script for my SCCM environment. The way it works is, you start up the Network boot. The HTA script pops up. You select the country, profile and location. And based on that, the deployment will choose the right steps. My problem is, I succesfully created two Task Sequence variables with associated dropdownlists. But now I am trying to get the 3rd one (Location) to work. The HTA script shows up succesfully, but when I hit the submit button with my choices from the dropdownlist, I get this error:

"Object doesn't support this property or method:
window.Location.selectedIndex"

My code:


<HEAD>
<TITLE>Task Sequence Menu</TITLE>
<HTA:APPLICATION APPLICATIONNAME="Task Sequence Menu" SCROLL="no" SINGLEINSTANCE="yes" WINDOWSTATE="normal" SYSMENU="no" CAPTION="no" BORDER="none" INNERBORDER="no">
<link rel="stylesheet" href="css/fonts.css" type="text/css" charset="utf-8" />
<SCRIPT LANGUAGE="VBScript">
'Resize window
Sub Window_onLoad
window.resizeTo 500,225
window.moveTo (screen.width - 500)/2, (screen.height - 225)/2
End Sub

'Hides Task Sequence Progress
Set ProgressUI = CreateObject("Microsoft.SMS.TSProgressUI")
ProgressUI.CloseProgressDialog

Sub ButtonSkip
window.Close
End Sub

Sub ButtonFinish
Dim strCountry
Dim strLocation
Dim strMode

Set TSEnv = CreateObject("Microsoft.SMS.TSEnvironment")

oCountryElements = Window.Country.selectedIndex
strCountry = Window.Country.options(oCountryElements).Text

'Set select DropdownList
Select Case strCountry
Case "Country1"
TSEnv("Country") = "CO"
Case "Country2"
TSEnv("Country") = "CT"
End Select

oLocationElements = Window.Location.selectedIndex
strLocation = Window.Location.options(oLocationElements).Text

'Set select DropdownList
Select Case strLocation
Case "Location1"
TSEnv("Location") = "3343"
Case "Location2"
TSEnv("Location") = "3344"
End Select

TSEnv("Mode") = "WIPENLOAD"

'Closes window
window.Close
End Sub
</SCRIPT>
</HEAD>

<BODY>
<div id="container">
<div id="header">
<img src="css/fact.png">
</div>
<div id="content">
<p>If you'd like to keep the current configuration/profile and hostname, click <span style="color: #ff6600; font-weight: bold">skip</span>. Otherwise, make the apropriate selections below and click <span style="color: #ff6600; font-weight: bold">generate</span>.</p>
<p>
<SELECT NAME="Country">
<OPTION>Country1</OPTION>
<OPTION selected="yes">Country2</OPTION>
</SELECT>
<SELECT NAME="Location">
<OPTION>Location1</OPTION>
<OPTION selected="yes">Location2</OPTION>
</SELECT>
</p>
<br />
<p>
<INPUT id=skipbutton type="button" value="skip" name="skip_button" onClick="ButtonSkip"> <INPUT id=runbutton type="button" value="generate" name="run_button" onClick="ButtonFinish"></span>
</p>
</div>
</div>
</BODY>

Continue reading...
 
Back
Top