Click to See Complete Forum and Search --> : This one is blowing my mind....HELP
capone
Jun 25th, 2000, 09:16 PM
Now first of all I'm not a programmer or a web developer, I'm a finance intern that got stuck creating one heck of a web site. What I'm having a problem with is one page that needs to do a few things:
1. Download a text file from the internet.
2. Format the text file so that I can put it on the web page as a table.
3. Post the data, and keep the data that was in the table already.
4. Do this every half hour on the half hour with an automatic refresh.
Now after looking through the board I've found the code to download the file, but the problem is that the number and name of the files changes every hour, as well as having a new name each day. There is one file per hour per day.
I think I can figure out how to format the files once I've got them downloaded, but I'm not sure about this.
I have no idea how I'm going to refresh it every half hour (and it's at every :30 not every half hour, so it needs to refresh at 9:00 and 9:30 and 10:00 etc....) and how to add to the table without losing the stuff that's already in the table.
I would really appreciate help with any part of this, or all of it if you can.
Thanks in advance.
Zaf Khan
Jun 26th, 2000, 09:11 AM
as loong as all your other code is okay and the prog operates as it ought to (less the half hour thing) then i dont see no reason why you can't use a timer control and set it to (60 seconds * 30 minutes = i'm not sure but...)
and remember it ins increments of 1000 so 1 second =1000
DocZaf
{;->
Mark Sreeves
Jun 26th, 2000, 02:45 PM
1. Use an InterNet Transfer control to download the file
2.
3.Is the site ASP able?
If not..
I sugget you keep all the data in a database and then write it out to a .html file and ftp it back to your site
You can ftp files using InterNet Transfer control or Wininet API calls. There should be examples to help you with this on this forum.
if you can run Active Server Pages, that makes life a bit easier
4. a timer contol only goes upo to just over a minute so the best think to do is to have a timer control checking the time at intervals
set timer to half minute interval ie: 30000
Private Sub Timer1_Timer()
Select Case Val(Format(Now(), "nn"))
Case 0, 30
'call your download code here
Case Else
End Select
End Sub
capone
Jun 26th, 2000, 08:03 PM
Thanks guys, that really helps. These questions may be stupid, but I don't know that much about web development (I'm a finance geek) so I have to ask. First where would that Timer code go? In a vbscript inside the web page, or would I need to do an include? Second, what's the "nn" stand for, is that the 30000?
Mark Sreeves
Jun 26th, 2000, 08:14 PM
OK, My suggestions were really for a stand alone VB executable.
Format(Now(), "nn") just displays the minutes part of the current date/time
capone
Jun 26th, 2000, 08:39 PM
Is there anyway to do it on a web page? They want this on a web page table that updates automatically every 30 minutes. If there's no way, I guess I could write the stand alone to update the web page, but I would rather have the web page do it since I'm going to be leaving here in a few months, and the web page will be easier for them to maintain. Thanks again for your help.
Mark Sreeves
Jun 26th, 2000, 10:16 PM
When you say a webpage do you mean an Active Server Page or just a standard html page?
capone
Jun 26th, 2000, 11:30 PM
Active Server Page.
Mark Sreeves
Jun 27th, 2000, 03:15 PM
This is pretty complicated stuff!
I think it should be possible to do it all within an Active Server Page.
You could put client-side code in so the page reloads at 00 and 30 minutes past the hour.
You say the name of the file you need to read changes constantly. How?
Is the name a date/time stamp or somthing?
Is the file of a consistant format?
capone
Jun 27th, 2000, 07:50 PM
The file name changes based on the date and hour. There is a new file every hour (but just in case they're a little late I want to update every half hour). I don't know how to do the client side coding. I just ordered a book: Professional Active Server Pages 2.0 from Wrox Publishing, so when it gets here I might know how. The file is in the same format, a comma delimited text file with "'s as a text qualifier. I would be much happier if I could do it within an ASP 'cause this would be much easier for them to maintain once I am gone.
Mark Sreeves
Jun 28th, 2000, 03:02 AM
I've used some server-side javascript here to format the date and hours...
<%@ Language=VBScript %>
<HTML>
<HEAD>
<script language='Javascript' runat='server'>
function dateStamp(){
var now = new Date();
return now.getYear().toString() + (now.getMonth()+1).toString() + now.getDate().toString();
}
function hourStamp(){
var now = new Date();
return now.getHours();
}
</script>
</HEAD>
<BODY>
<%
Response.Write dateStamp() & "<BR>"
Response.Write hourStamp() & "<BR>"
%>
</BODY>
</HTML>
capone
Jun 28th, 2000, 03:33 AM
Again thanks, I'll read in the books how to use the variables you've created. Thanks.....
Mark Sreeves
Jun 28th, 2000, 05:45 AM
dim strUrl
dim strTemp
strUrl = "http://www.caiso.com/cgi-bin/pubmkt2.cgi?Action=Download&Download={selection}&Fcastdate=" & dateStamp() & "&hour=" & hourStamp()
strTemp = inet.openurl(strurl)
I can't help you with:
{selection}
though!
[Edited by Mark Sreeves on 06-29-2000 at 03:17 AM]
capone
Jun 28th, 2000, 09:08 PM
I've been gettinga type mismatch error with the dateStamp() function. I've been trying to firgure it out on my own, but I'm coming up blank. I thought ASP used only variants, which would mean there is no way to have a type mismatch.
Zaf Khan
Jul 1st, 2000, 04:16 PM
The next piece of the jigsaw puzzle!
I've used some server-side javascript here to format the date and hours...
code:--------------------------------------------------------------------------------<%@ Language=VBScript %>
<HTML>
<HEAD>
<script language='Javascript' runat='server'>
function dateStamp(){
var now = new Date();
I note that the subroutine is declared as being in VBSCRIPT when it is in effect in JAVASCRIPT so change the VBSCRIPT to JAVASCRIPT
DocZaf
{;->
Mark Sreeves
Jul 3rd, 2000, 02:45 AM
That's NOT correct!
Having server-side Javascipt within VBScript is perfectly ok.
I ALWAYS test my scripts before posting to this forum.
Zaf Khan
Jul 3rd, 2000, 05:39 AM
Hmmmmm, I see, siad the blind man,
I apologise Mark, well I'm happy now cos i learned something new,
Thanks
DocZaf
{;->
Mark Sreeves
Jul 3rd, 2000, 05:45 AM
That's OK Zaf!
I only discovered it myself a few weeks ago!
I found it while trying to answer another thread:
http://forums.vb-world.net/showthread.php?threadid=19932
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.