Tidied up a bit, simplified a bit, "explicit" safe, "novarsinstrings" safe, short form hungarian'ed...
Code:
Break ON
$=SetOption("WrapAtEOL","ON")
$=SetOption("ASCII","ON")
$=SetOption("Explicit","ON")
;
; SCRIPT: quote.kix
;
; USAGE: kix32 quote $sStock=symbol $sExchange=exchange
;
; EXAMPLE: kix32 quote $sStock=brk.b $sExchange=x (Berkshire Hathaway on New York)
; EXAMPLE: kix32 quote $sStock=td $sExchange=t (Toronto Dominion Bank on Toronto)
;
; Submits a cgi request AND parses returned html for information...
;
Dim $oIE,$sSentinel,$sURL,$sLine
If Not IsDeclared($sStock) Global $sStock EndIf
If Not IsDeclared($sExchange) Global $sExchange EndIf
; Check commAND line parameters & set defaults ...
If Not $sStock $sStock = "BRK.B" EndIf
if Not $sExchange $sExchange = "X" EndIf
$sURL = 'http://www.bmoinvestorline.com/cgi-bin/t3i.3.cgi/e/ilmquote.taf?textfield='+$sStock+'&Exchange='+$sExchange
$sSentinel = 'Last: '
$oIE = createobject("internetexplorer.application")
$oIE.navigate($sURL)
While $oIE.readystate <> 4 AND $oIE.busy AND @error = 0 Loop
While $oIE.document.readystate <> "complete" AND @error = 0 Loop
For Each $sLine in Split($oIE.document.body.innerText,@CRLF)
If InStr($sLine,$sSentinel) $sLine ? EndIf
Next
$oIE.quit
$oIE = 0
exit 0