#VLT & QuickB
Ok, you asked for it! 🙂 This is just the first cut. I had this working
originally with Xmodem, but that is kind of slow. I want to speed it up
by using QuickB. BTW, which xprquickb.library are you using? Maybe I
have a different quickb lib, or an older version. The version command
tells me mine is "XPR Quick B v1.2". It is 15016 bytes long.
/** GetWeather.vlt **/
trace commands
userid="73227,2656"
password="**********"
/* Add libraries if necessary */
if show("l", "rexxarplib.library") = 0 ,
then do
call addlib('rexxsupport.library', 0, -30, 0)
call addlib('rexxarplib.library', 0, -30, 0)
call addlib('rexxmathlib.library', 0, -30, 0)
end
/* First define some text strings and procedures. Here we assume * a
Hayes compatible modem. If you have a different modem, you should * be
able to change just the following three strings.
*
* Here's a set of responses that is given by Hayes modems: */
response = "OK"
connectstr = "CONNECT 9600"
busystr = "BUSY"
nocarrierstr = "NO CARRIER"
/* build a date-time string for report names */
rptdate='.'||compress(date('o'),'/')||'-'||time('h')
forecastname="Forecast" || rptdate || ".txt"
/* Here is a hangup script that may work for Hayes modems.
* You could also just drop DTR if that works for you:
*
* hangupscript = "hangup" */
hangupscript = "on (OK) continue; send (+++); delay 2; send (ATH); "
hangupscript = hangupscript || "on (OK) (); delay 1; send (*R*R)"
/* This script I use to get the modem in line after changing parity. *
You may be able to get away with not doing anything, like this: *
* retrainscript = "" */
retrainscript = "on (OK) exit; $1: delay .3; send (AT*R); goto $1"
/* name of VLT rexx port */
vltport="GetWeather"
/* Okay, to the real work. First set the port to that of this invocation
* of VLT. */
address command "runwsh VLT:VLT +u 2 +n" vltport
address command WAITFORPORT vltport
address value vltport
/* Check if we're set up correctly without requesters coming up. * If
not, call the setup program */
call pragma('W','NULL')
/*
*
* Preset the cancel flag to something, announce who we're calling, *
set baud and parity. Then do the first (predial) set of commands. */
vlt.CANCELFLAG = "start"
"message (Dialing CompuServe…)"
"baud 9600"
"parity 7E1"
"handshake Xon"
"ansicolormode off"
"volume 0"
"buffersize 8192"
"rendermode quick"
"transfer Mode image"
"transfer protocol Quickb"
"xpr INIT OY"
/* "xmodemmode 128 CRC" */
/* We may have changed parity, and the modem may need some time. */ if
retrainscript ~= "" then retrainscript
/* Send the modem string if any. */
"on ("response") continue; send (ATE0 Q0 V1 *X2AE1 X4*R*N); delay 5"
/* Set up the "CONNECT" trap. Make it start postdial set of commands *
if there are any. */
"trap add 314 install ("connectstr") (graphicslock on;screeng off; echo
off; cancel $vltphone_wait connect)"
/* Set up the BUSY and NO CARRIER traps. Note the use of the new feature
* of the CANCEL command. */
"trap add 315 install ("busystr") (cancel $vltphone_wait busy)" "trap
add 316 install ("nocarrierstr") (cancel $vltphone_wait nocarrier)"
/* Send dial string and wait until the "pause" gets cancelled */
"$vltphone_wait: send (ATDT650-5143*R); pause"
/* We got cancelled. See which event cancelled us. */
event = vlt.CANCELFLAG
/* Remove the traps but only the ones we used. */
"trap remove 314 315 316"
/* If we got connected, then do our thing. */
if upper(event) = "CONNECT" ,
then do
"message (Connected to CompuServe)"
"send (*R)"
"wait (Host Name:) 3"
"send (CIS*R)"
"wait (User ID:) 3"
"send ("userid"*R)"
"wait (Password:) 3"
"send ("password"*R)"
"wait (!) 15"
"send (go weather*R)"
"wait (!)" 60
"send (1*R)"
"wait (MORE !) 8"
"cd AP:Headlines"
"send (1*R)"
"wait (local:) 5"
"capture" forecastname
"send (*R)"
"wait (!) 15"
"capture flush; capture off"
"send (*R)" /* get weather menu again */
"wait (MORE !) 4"
"cd AP:WeatherMaps"
"send (4*R)" /* radar map */
"wait (!) 3" /* protocol */
"send (6*R)" /* xmodem */
"wait (is complete) 5"
"send (Radar.wmap*R)"
"file receive Radar.wmap" /* do the receive */
call grabamap(7,"ConusSat")
call grabamap(9,"00_Weather")
call grabamap(10,"24_Weather")
call grabamap(11,"48_Weather")
call grabamap(13,"Night_Lows")
call grabamap(14,"24_Highs")
call grabamap(18,"SCen_NA")
"send (bye*R)"
"wait (Host Name:) 20"
hangupscript
end
/* If we need to resume, send a few hangups. */
if upper(event) = "RESUME" then hangupscript
/* Check if we got an abort event. If so, quit. */
if upper(event) = "ABORT" ,
then "message (Aborted!)"
"exit VLT quiet"
exit 0
grabamap: procedure
mapnum=arg(1)
mapname=arg(2)
"wait (MORE !) 3"
"send ("mapnum"*R)"
"send ("mapname".wmap*R)"
"file receive" mapname".wmap"
return