Ok, just needed a tweak and a poke ...
Code:
break on
;
; SCRIPT: quote.kix
;
; USAGE: kix32 quote $stock=symbol $exchange=exchange
;
; EXAMPLE: kix32 quote $stock=brk.b $exchange=x (Berkshire Hathaway on New York)
; EXAMPLE: kix32 quote $stock=td $exchange=t (Toronto Dominion Bank on Toronto)
;
; Submits a cgi request and parses returned html for information...
;
; Check command line parameters & set defaults ...
if $stock
else
$stock = "BRK.B"
endif
if $exchange
else
$exchange = "X"
endif
$URL = 'http://www.bmoinvestorline.com/cgi-bin/t3i.3.cgi/e/ilmquote.taf?textfield=$stock&Exchange=$exchange'
$PARSE1 = 'Last: '
$CRLF = CHR(13)+CHR(10)
?"Searching "
$ie = createobject("internetexplorer.application") "."
$ie.navigate($URL) "."
while $ie.readystate <> 4 and $ie.busy and @error = 0 loop "."
while $ie.document.readystate <> "complete" and @error = 0 loop "."
$html = $ie.document.documentelement.innerhtml
$len = len($html)
$pos = instr($html, $PARSE1)
if $pos
$pos = $pos + len("$PARSE1")
$html = substr($html, $pos, $len)
$price = substr($html,1,instr($html," ")-1)
?
?"$stock:$exchange = $price"
?
else
?"Error getting stock quote"
endif
; Cleanup ...
$ie.quit
$ie = 0
exit 1
-Shawn