Can anyone help me with this.
I am attempting to make a selection from a Drop Down menu and write
that selection to a text file.
Any help would be greatly appreciated.
Thanks,
Cisco


<html>
<head>
<title>HTA Helpomatic</title>

<HTA:APPLICATION
ID="objHTAHelpomatic"
APPLICATIONNAME="HTAHelpomatic"
SCROLL="yes"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximize"
>
</head>

<SCRIPT Language="VBScript">


Sub RunScript
Msgbox DropDown1.Value
End Sub



''''''''''''''''''''''''''''''''''''''''''''''''
strtext = DropDown1.value
Const FOR_READING = 1
Const FOR_WRITING = 2

strFileName = "test.txt"
strNewContent = "sample string content"

Set objFS = CreateObject("Scripting.FileSystemObject")
Set objTS = objFS.OpenTextFile(strFileName,FOR_READING)
strContents = objTS.ReadAll
objTS.Close
Set objTS = objFS.OpenTextFile(strFileName,FOR_WRITING)
objTS.WriteLine strComputer
objTS.Write strContents
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

</SCRIPT>
<body>
<fieldset>
<select size="1" name="DropDown1">
<option value="1">Option 1</option>
<option value="2">Option 2</option>
<option value="3">Option 3</option>
<option value="4">Option 4</option>
</select>
</fieldset>

<input id=runbutton class="button" type="button" value="Run Script"
name="ok_button"onClick="RunScript">

<input id=runbutton class="button" type="button" value="Cancel"
name="cancel_button" onClick="CancelScript">
<P>
<span id=DataArea></span>

</body>
</html>

Re: select from list box and write to file by Ayush

Ayush
Mon Jan 29 15:46:12 CST 2007

Replied to [imaciscoguy]s message :
> Can anyone help me with this.
> I am attempting to make a selection from a Drop Down menu and write
> that selection to a text file.
> Any help would be greatly appreciated.
> Thanks,
> Cisco


If you want the value of selected option then use :
DropDown1.options(DropDown1.selectedIndex).value

DropDown1 is select Element
DropDown1.options is a collection of option elements

DropDown1.selectedIndex returns the index of selected option

so
DropDown1.options(DropDown1.selectedIndex) = the selected option element
and
DropDown1.options(DropDown1.selectedIndex).value = the selected option element's
value attribute/property

--
â?? Ayush
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------

Re: select from list box and write to file by imaciscoguy

imaciscoguy
Mon Jan 29 17:07:14 CST 2007

w

On Jan 29, 3:46=C2=A0pm, Ayush <"ayushmaan.j[aatt]gmail.com"> wrote:
> Replied to [imaciscoguy]s message :
>
> > Can anyone help me with this.
> > I am attempting to make a selection from a Drop Down menu and write
> > that selection to a text file.
> > Any help would be greatly appreciated.
> > Thanks,
> > CiscoIf you want the value of selected option then use :
> DropDown1.options(DropDown1.selectedIndex).value
>
> DropDown1 is select Element
> DropDown1.options is a collection of option elements
>
> DropDown1.selectedIndex returns the index of selected option
>
> so
> =C2=A0 DropDown1.options(DropDown1.selectedIndex) =3D the selected option=
element
> and
> DropDown1.options(DropDown1.selectedIndex).value =3D the selected option =
element's
> value attribute/property
>
> --
> =E2=86=92 Ayush
> -------------
> Search =C2=A0 =C2=A0-www.Google.com| Wikipedia =C2=A0 =C2=A0-http://en.wi=
kipedia.org
> Snip your long urls =C2=A0 -http://snipurl.com/
> -------------


Re: select from list box and write to file by imaciscoguy

imaciscoguy
Mon Jan 29 17:16:52 CST 2007

Ayush,

Wow.
I hate to say it, but I can't figure out how to use this additional=20
information. If it is not too much trouble could you go a little =20
deeper with me. I'm still a little green.

Thanks,
Cisco

On Jan 29, 5:07=C2=A0pm, "imaciscoguy" <imacisco...@yahoo.com> wrote:
> w
>
> On Jan 29, 3:46=C2=A0pm, Ayush <"ayushmaan.j[aatt]gmail.com"> wrote:
>
>
>
> > Replied to [imaciscoguy]s message :
>
> > > Can anyone help me with this.
> > > I am attempting to make a selection from a Drop Down menu and write
> > > that selection to a text file.
> > > Any help would be greatly appreciated.
> > > Thanks,
> > > CiscoIf you want the value of selected option then use :
> > DropDown1.options(DropDown1.selectedIndex).value
>
> > DropDown1 is select Element
> > DropDown1.options is a collection of option elements
>
> > DropDown1.selectedIndex returns the index of selected option
>
> > so
> > =C2=A0 DropDown1.options(DropDown1.selectedIndex) =3D the selected opti=
on element
> > and
> > DropDown1.options(DropDown1.selectedIndex).value =3D the selected optio=
n element's
> > value attribute/property
>
> > --
> > =E2=86=92 Ayush
> > -------------
> > Search =C2=A0 =C2=A0-www.Google.com|Wikipedia =C2=A0 =C2=A0-http://en.w=
ikipedia.org
> > Snip your long urls =C2=A0 -http://snipurl.com/
> > -------------- Hide quoted text -- Show quoted text -


Re: select from list box and write to file by imaciscoguy

imaciscoguy
Mon Jan 29 19:16:11 CST 2007

Ayush,

You are my new best friend!
I have been working on this for a day and a half, and you showed me /=20
taught me in minutes.

Thanks again,
Cisco

On Jan 29, 6:06=C2=A0pm, Ayush <"ayushmaan.j[aatt]gmail.com"> wrote:
> Replied to [imaciscoguy]s message :
>
> > Ayush,
>
> > Wow.
> > I hate to say it, but I can't figure out how to use this additional
> > information. If it is not too much trouble could you go a little =C2=A0
> > deeper with me. I'm still a little green.See the attached txt file (cha=
nge extension to hta to run it).
>
> --
> =E2=86=92 Ayush
> -------------
> Search =C2=A0 =C2=A0-www.Google.com| Wikipedia =C2=A0 =C2=A0-http://en.wi=
kipedia.org
> Snip your long urls =C2=A0 -http://snipurl.com/
> -------------
>
> [DropDown.txt]<html>
> <head>
> <title>HTA Helpomatic</title>
> <HTA:APPLICATION WINDOWSTATE=3D"maximize">
> </head>
>
> <SCRIPT Language=3D"VBScript">
>
> Sub RunScript
>
> strtext =3D DropDown1.options(DropDown1.selectedIndex).value
> =C2=A0 =C2=A0 Const FOR_READING =3D 1
> =C2=A0 =C2=A0 Const FOR_Appending =3D 8
>
> strFileName =3D "test.txt"
>
> if msgbox("Append " & strtext & " to " & strFileName & " ?",vbYesNo)=3Dvb=
No then exit sub
>
> Set objFS =3D CreateObject("Scripting.FileSystemObject")
> Set objTS =3D objFS.OpenTextFile(strFileName,FOR_Appending)
> objTS.Write vbCrLf & strtext
> objTS.Close
>
> End Sub
>
> </SCRIPT>
> <body>
> <fieldset>
> <select size=3D"1" name=3D"DropDown1">
> <option value=3D"1">Option 1</option>
> <option value=3D"2">Option 2</option>
> <option value=3D"3">Option 3</option>
> <option value=3D"4">Option 4</option>
> </select>
> </fieldset>
>
> <input type=3D"button" value=3D"Run Script" onClick=3D"RunScript">
>
> </body>
> </html>


Re: select from list box and write to file by Ayush

Ayush
Mon Jan 29 19:43:32 CST 2007

Replied to [imaciscoguy]s message :
> Ayush,
>
> You are my new best friend!
> I have been working on this for a day and a half, and you showed me /
> taught me in minutes.
>
> Thanks again,
> Cisco


You are welcome imaciscoguy !


--
â?? Ayush
-------------
Search - www.Google.com | Wikipedia - http://en.wikipedia.org
Snip your long urls - http://snipurl.com/
-------------