Category : Communication (modem) tools and utilities
Archive   : SC40.ZIP
Filename : SC40Q-P.SCR

 
Output of file : SC40Q-P.SCR contained in archive : SC40.ZIP

;
;+
; Copyright (C) 1989-92 Terry Dutcher, All Rights Reserved
;
;***************************************************************************
;
; THIS PROGRAM IS PROVIDED ON AN "AS IS" BASIS ONLY.
;
; The author disclaims all warranties on the program, including without
; limitation, all implied warranties of merchantablity and fitness.
;
; Full permission and consent is hereby given to reproduce, distribute, and
; publish and to permit others to reproduce this program and information
; relating thereto according to the terms granted in the license agreement.
;
;***************************************************************************
;
; System Title: Set-Clock Date Created: 07-Apr-89
;
; Module Name: Qmodem Script Written By: Terry Dutcher
;
; Revsion Number: 04.0Q-P Revision Date: 03 August 1992
;
; Purpose:
;
; To front-end the CLKSET routine by dialing the Naval Observatory
; or NIST and passign it the time/date string (and switches etc.)
;
; Change Log:
;
; 0.0 to 2.4 - Prerelease versions
; 2.5 to 2.7 - Performed all processing in the command file
; 3.0 - Use external CLKSET routine to process and set clocks.
; 3.1 - Use external configuration file
; 4.0 - build CFG file via program, pursue NIST
;
;***************************************************************************
;-
; debug on
string n0 n1 n2

; init the screen

graphics vt100
color 17
clrscr
window 1 1 80 24

color 113
box 1 1 80 6
atwrite 23 3 31 " S e t - C l o c k - Version 4.0 "
atwrite 13 5 31 " Copyright (C) 1992 Terry Dutcher, All Rights Reserved "
box 20 8 60 12
atwrite 25 10 31 " --- Initializing --- "
window 1 14 80 24
color 17

gotoxy 1 16
send "ATE1^M"
waitfor "OK"
send "^[[?6h"
delay 1000
send "^[[15;23r"

exist clkset.exe findcfg
assign 1 "CLKSET routine not found ! "
gosub f_error

findcfg:
exist sc40-p.cfg opencfg
gosub cfg_it
goto findcfg

opencfg:
openfile sc40-p.cfg read
readfile 1
readfile 2
readfile 9
readfile 8
closefile

;
; Sample SC40-P.CFG. The file should contain only 4 lines. The lines
; MUST start in colum 1. The 1st line is the dialing directory entry
; tag to get to the local SprintNet PAD [use 1200-7-E-1 please]. The
; 2nd is your PC Pursuit UserId and password seperated only by a comma.
; The 3rd is the start of the CLKSET command line. The number is the
; local time offset from Universal (GMT). The 4th is which time signal
; source.
;
; thepad ;dialing directory entry tag for SprintNet
; USERID,PASSWORD ;pursuit id and pwd
; clkset 5 ;clkset command w/ east coast offset
; navy ;which time signal source
;

if "$8" <> "navy" is_nist
assign 6 " Pursuing the Naval Observatory "
assign 5 "Unable to pursue the Naval Observatory ! "
assign 3 "C D/DCWAS/12,$2"
assign n2 20
goto go_on
;
is_nist:
if "$8" <> "nist" is_unkn
assign 6 " Pursuing the NIST - ACTS "
assign 5 "Unable to pursue the NIST - ACTS ! "
assign 3 "C D/CODEN/12,$2"
assign n2 28
goto go_on
;
is_unkn:
assign 1 "Invalid or unknown time source in SC40.CFG ! "
gosub f_error

go_on:
atwrite 24 10 31 "$6"
color 16
getscr

dial "T$1"
if $online pursue
assign 1 "$5"
gosub f_error

pursue:
;
; PC Pursuit to the emerald city
;
send "^M"
send "^M"
timeout 30
waitfor "AL="
send "D1"
send "^M"
timeout 30
waitfor "@"
assign n0 0

get_to_dc:
if '$n0' <= '4' try_it
hangup
assign 1 "Double check your PC Pursuit id and password. "
goto f_error

try_it:
send "$3"
send "^M"
timeout 5 get_to_dc
incr n0
waitfor "CONNECTED"

;escape back to home PAD

send "@"
send "^M"
timeout 3 jmp1
waitfor "@"
goto set_up_modem
jmp1:
assign n1 0

; theres no place like home

tnplh:
if '$n1' < '9' at_cr
hangup
assign s1 "Unable to escape back to host PAD. "
goto f_error

at_cr:
send "@"
send "^M"
timeout 3 jmp2
waitfor "@"
goto gmooh
jmp2:
incr n1
goto tnplh

; get me out of here !

gmooh:
send "D"
send "^M"
timeout 3 gmooh
waitfor "@"
pause 5000
assign n0 0
goto get_to_dc

set_up_modem:
send "CONT^M"
pause 1000

send "ATZ"
send "^M"
timeout 3 jmp3
waitfor "OK"
goto em
jmp3:
assign n1 0
goto tnplh

em:
send "^E^M"
timeout 3 jmp3
waitfor "*"

if "$8" = "nist" do_nist

send "D6530351^M" ; NAVOBS phone number
timeout 8 jmp3
waitfor "DIALING..."
timeout 25 jmp3
waitfor "ANSWER TONE"
goto no_ec

do_nist:
send "D4944774^M" ; NIST-ACTS phone number
timeout 8 jmp3
waitfor "DIALING..."
timeout 25 jmp3
waitfor "ANSWER TONE"

no_ec:
timeout 30
waitfor "NO ERROR CONTROL"

; wait for a good string
get_str:
waitfor "*^M^J" ;wait for start of good string
getnr 1 $n2 ;get date / time string
hangup ;now hang up

; invoke clkset routine

gotoxy 1 23
display " "
assign 8 "$9 $1"
clrscr
dos "$8"

putscr
color 113
box 20 8 60 14
atwrite 27 10 31 " DOS Time and Date set to: "
atwrite 31 11 31 " $time $date "
atwrite 22 13 113 "$1"

color 17
window 1 1 80 24
gotoxy 1 23
displayln " "
delay 10000
system y

;
bookem:
;+
; BOOKEM (as in Danno) Routine. Play dragnet music.
;-
beep 587 100
delay 35
beep 659 50
delay 20
beep 698 50
delay 20
beep 587 175
return
;
f_error:
;+
; F_ERROR Routine. Prints error text and exits to DOS.
;-
color 17
window 1 1 80 24
clrscr
hangup
color 113
box 1 1 80 6
atwrite 3 4 31 " F A T A L E R R O R -- "
atwrite 32 4 31 "$1"
color 17
window 1 1 80 24
gotoxy 1 23
displayln " "
getscr
gosub bookem
delay 7000
system y
return
;
cfg_it:
;+
; CFG_IT Routine. Subroutine to create config file on the fly.
;-
gosub bookem

fnf:
atwrite 1 15 7 "Config file not found. Create it ? [Y/N] "
gotoxy 44 15
flush all
inkey 0
if "$0" = "Y" is_cfg_sc
if "$0" = "y" is_cfg_sc
if "$0" = "N" finis
if "$0" = "n" finis
goto fnf

finis:
system y

is_cfg_sc:
exist cfg-sc.exe cfg_sc
assign 1 "Configure SetClock routine not found ! "
gosub f_error

cfg_sc:
getscr
clrscr
dos "cfg-sc qmodem pursuit"
putscr
atwrite 1 15 7 " "
atwrite 1 15 7 "Continue execution ? [Y/N] "
gotoxy 27 15
flush all
inkey 0
if "$0" = "Y" do_it
if "$0" = "y" do_it
system y

do_it:
return