View Single Post
Old July 3rd, 2009, 08:07 AM   Digg it!   #1 (permalink)
wedeje
Junior Member
 
Join Date: Jul 2009
Posts: 2
Stock Quotes Script

I don't understand anything about variables in VBScripts so I ask help.
Two years ago someone made a script for me that worked fine until now, as the website I got the quotes from moved the table.
This is the URL : IEX.NL: van beleggers, voor beleggers -columns, realtime koersen, nieuws, forums,agenda en meer-. Beleggen aandelen, beurs, AEX
There you see a (Streaming Realtime) block in which the quotes are presented. Those quotes I want to write to a textfile at a fixed timeinterval one after the other to read it in my analysing spreadsheet.
This is the script I used until now and I hope someone will make changes sothat it works again.
>
>
>
On Error Resume Next
Const ForReading=1, ForWriting=2, ForAppending=8
' Assign the table's contents to a variable.
Do While Hour(now) < 18
Dim objXMLHTTP, xml, Dat, Tm, Vm, Trd, Td, f, fso

Set xml = CreateObject("Microsoft.XMLHTTP")
xml.Open "GET", "http://www.iex.nl/webService/tbmTrades.aspx?Id=12272", False
xml.Send
pgcode = xml.responseText
Set xml = Nothing

' Break the variable up into peices based on html tags.
Dat = Split(pgcode, "<td align='right'>")
Tm = Split(Dat(1), "</td>")
Vm = Split(Dat(2), "</td>")
Trd = Split(Dat(3), "</td>")
Td = Replace(Trd(0), ",", ".")

' Create a text file with today's date as the name & write the data we are interested in to the text file.
Dy = Day(now)
If Dy < 10 Then Dy = "0" & Dy
Mn = Month(now)
If Mn < 10 Then Mn = "0" & Mn
Yr = Year(now)
Fn = "C:\Program Files\vtplus\s\vtplus\1min.txt"
Set fso=CreateObject("Scripting.FileSystemObject")
Set f=fso.OpenTextFile(Fn,ForAppending,True)
f.Write Tm(0) & "," & Vm (0) & "," & Td & vbCrLf
f.Close

Wscript.sleep 60000
Loop
wedeje is offline   Reply With Quote
Search TechIMO for Answers: