Forums
This topic is locked
vbscript / AOL / filesystemobject
Posted 04 Dec 2007 18:09:27
1
has voted
04 Dec 2007 18:09:27 Paul Blair posted:
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>
Replies
Replied 11 Feb 2013 11:14:19
11 Feb 2013 11:14:19 Les IsOnline replied:
I don't think AOL allow you to access the FSO on their webspace that you get with your ISP accounts as far as I recall.