This is a forum where members new and old can come to ask questions and get info and opinions. It is not a place to advertise your business or have other forms of advertising, whether it be in your posts or signature.

All links in the forum will not be indexed by Search Engines and any unapproved forms of advertising or spam will be dealt with accordingly, deleted, and that member's account banned.

Forums

Overview » Web Accessibility » vbscript / AOL / filesystemobject
Reply

vbscript / AOL / filesystemobject

Paul Blair
Member



Since: 04 Dec 2007
Posts: 1
Posted 04 Dec 2007 18:09:27

Hi, obvious (vbscripting) rookie here.

This piece of html / vbscript works on the client side with the file I want to access sitting in a directory on my PC. I upload the code to my AOL space, upload the file and I have no luck accessing the file. I've even saved (as I was directed by another 'guru' as .hta but can't seem to get the members.aol.com to recognize it. All I wish to accomplish is to open a web page, display entries in a listbox from a file sitting on the AOL server. Sorry to introduce this stuff on my first visit to this site, but I'm as frustrated as I've been in a long time trying to get vbscript to work consistently. Thanks for your help.

Paul....

<html>
<head>
<title>My Page</title>
</head>
<SCRIPT Language="VBScript">
option explicit
dim strContents(700)
dim jmax
dim fpath
Sub FillListbox
dim i
dim oOption
dim objOption
For i = 0 to jmax - 1
set oOption = document.createElement("OPTION"
AvailColl.Options.add oOption
oOption.innerText = strContents(i)
oOption.value = i
Next
document.getElementById("twobutton".disabled = true
End Sub
Sub FillList
dim i
dim sScriptPath
dim objFSO
dim objFile
dim objReadFile
' the file name is is hobbywebinx.dat _
' located in "members.aol.com/pblair/"
sScriptPath = location.pathname
' this produces "pblair/index.html"
Set objFSO = CreateObject("Scripting.FileSystemObject"
Set objFile = objFSO.GetFile("what do I use here?"
If objFile.Size > 0 Then
msgbox "Got it"
else
msgbox "Didn't get it"
exit sub
end if
if objFSO.FileExists("what do I use here?" then
'msgbox " GOT IT !!!!"
Set objFile = objFSO.GetFile("what do I use here?"
i = 0
If objFile.Size > 0 Then
Set objReadFile = objFSO.OpenTextFile("what do I use here?", 1)
jmax = objReadFile.Read(2)
objReadFile.SkipLine
Do Until objReadFile.AtEndOfStream
strContents(i) = objReadFile.Read(62)
objReadFile.SkipLine
i = i + 1
Loop
objReadFile.Close
End If
else
msgbox "DIDN'T GET IT !!!"
end if
' this routine puts the entries just read into the listbox
FillListbox
Set objFSO = Nothing
Set objFile = Nothing
Set objReadFile = Nothing
End Sub
</SCRIPT>

<body bgcolor="palegreen">
<center><b>Welcome To<br><font face="arial" color="navy" size="+2">My Page</font><br></b>
<font size="-1"></font>
</center><hr><br><br>
<center>
<select size="8" name="AvailColl" style="width:450; font-family: Courier New; font-size: 12px">
</select><br><br>
<input id=twobutton class="button" type="button" value="Fill Listbox"
name="two_button" onClick="FillList">
</center>
</body>
</html>

Hi, obvious (vbscripting) rookie here.

This piece of html / vbscript works on the client side with the file I want to access sitting in a directory on my PC. I upload the code to my AOL space, upload the file and I have no luck accessing the file. I've even saved (as I was directed by another 'guru' as .hta but can't seem to get the members.aol.com to recognize it. All I wish to accomplish is to open a web page, display entries in a listbox from a file sitting on the AOL server. Sorry to introduce this stuff on my first visit to this site, but I'm as frustrated as I've been in a long time trying to get vbscript to work consistently. Thanks for your help.

Paul....

<html>
<head>
<title>My Page</title>
</head>
<SCRIPT Language="VBScript">
option explicit
dim strContents(700)
dim jmax
dim fpath
Sub FillListbox
dim i
dim oOption
dim objOption
For i = 0 to jmax - 1
set oOption = document.createElement("OPTION"
AvailColl.Options.add oOption
oOption.innerText = strContents(i)
oOption.value = i
Next
document.getElementById("twobutton".disabled = true
End Sub
Sub FillList
dim i
dim sScriptPath
dim objFSO
dim objFile
dim objReadFile
' the file name is is hobbywebinx.dat _
' located in "members.aol.com/pblair/"
sScriptPath = location.pathname
' this produces "pblair/index.html"
Set objFSO = CreateObject("Scripting.FileSystemObject"
Set objFile = objFSO.GetFile("what do I use here?"
If objFile.Size > 0 Then
msgbox "Got it"
else
msgbox "Didn't get it"
exit sub
end if
if objFSO.FileExists("what do I use here?" then
'msgbox " GOT IT !!!!"
Set objFile = objFSO.GetFile("what do I use here?"
i = 0
If objFile.Size > 0 Then
Set objReadFile = objFSO.OpenTextFile("what do I use here?", 1)
jmax = objReadFile.Read(2)
objReadFile.SkipLine
Do Until objReadFile.AtEndOfStream
strContents(i) = objReadFile.Read(62)
objReadFile.SkipLine
i = i + 1
Loop
objReadFile.Close
End If
else
msgbox "DIDN'T GET IT !!!"
end if
' this routine puts the entries just read into the listbox
FillListbox
Set objFSO = Nothing
Set objFile = Nothing
Set objReadFile = Nothing
End Sub
</SCRIPT>

<body bgcolor="palegreen">
<center><b>Welcome To<br><font face="arial" color="navy" size="+2">My Page</font><br></b>
<font size="-1"></font>
</center><hr><br><br>
<center>
<select size="8" name="AvailColl" style="width:450; font-family: Courier New; font-size: 12px">
</select><br><br>
<input id=twobutton class="button" type="button" value="Fill Listbox"
name="two_button" onClick="FillList">
</center>
</body>
</html>

Reply to this topic

Message
Reply
Follow us on Facebook Follow us on twitter Subscribe to the RSS feed
Activate your free membership today | Login | Currency